annotate src/w32fns.c @ 36252:a8630c63f7d5

Rename everything containing *busy_cursor* and similar to *hourglass*. (syms_of_w32fns): Rename x-busy-pointer-shape to x-hourglass-pointer-shape, display-busy-cursor to display-hourglass, busy-cursor-delay to hourglass-delay.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 21 Feb 2001 13:55:14 +0000
parents 743534626f73
children aa32e4e49d10
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
1 /* Graphical user interface functions for the Microsoft W32 API.
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
2 Copyright (C) 1989, 92, 93, 94, 95, 1996, 1997, 1998, 1999, 2000, 2001
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3 Free Software Foundation, Inc.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5 This file is part of GNU Emacs.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7 GNU Emacs is free software; you can redistribute it and/or modify
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9 the Free Software Foundation; either version 2, or (at your option)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
10 any later version.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
11
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
15 GNU General Public License for more details.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
16
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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: 13434
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: 13434
diff changeset
20 Boston, MA 02111-1307, USA. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
21
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
22 /* Added by Kevin Gallo */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
24 #include <config.h>
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
25
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
26 #include <signal.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
27 #include <stdio.h>
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
28 #include <limits.h>
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
29 #include <errno.h>
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
30
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
31 #include "lisp.h"
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
32 #include "charset.h"
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
33 #include "dispextern.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34 #include "w32term.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
35 #include "frame.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
36 #include "window.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
37 #include "buffer.h"
28272
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
38 #include "fontset.h"
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
39 #include "intervals.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
40 #include "keyboard.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
41 #include "blockinput.h"
24412
d11ac02f9d6a Use epaths.h istead of paths.h.
Richard M. Stallman <rms@gnu.org>
parents: 24339
diff changeset
42 #include "epaths.h"
16593
4ed80eda6fac Use new names for w32 files
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
43 #include "w32heap.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
44 #include "termhooks.h"
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
45 #include "coding.h"
25069
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
46 #include "ccl.h"
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
47 #include "systime.h"
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
48
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
49 #include "bitmaps/gray.xbm"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
51 #include <commdlg.h>
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
52 #include <shellapi.h>
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
53 #include <ctype.h>
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
54
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
55 #define max(a, b) ((a) > (b) ? (a) : (b))
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
56
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
57 extern void free_frame_menubar ();
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
58 extern double atof ();
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
59 extern int w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
60 extern int quit_char;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
61
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
62 /* A definition of XColor for non-X frames. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
63 #ifndef HAVE_X_WINDOWS
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
64 typedef struct {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
65 unsigned long pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
66 unsigned short red, green, blue;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
67 char flags;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
68 char pad;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
69 } XColor;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
70 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
71
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
72 extern char *lispy_function_keys[];
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
73
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
74 /* The gray bitmap `bitmaps/gray'. This is done because w32term.c uses
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
75 it, and including `bitmaps/gray' more than once is a problem when
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
76 config.h defines `static' as an empty replacement string. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
77
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
78 int gray_bitmap_width = gray_width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
79 int gray_bitmap_height = gray_height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
80 unsigned char *gray_bitmap_bits = gray_bits;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
81
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
82 /* The colormap for converting color names to RGB values */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
83 Lisp_Object Vw32_color_map;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
84
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
85 /* Non nil if alt key presses are passed on to Windows. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
86 Lisp_Object Vw32_pass_alt_to_system;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
87
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
88 /* Non nil if alt key is translated to meta_modifier, nil if it is translated
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
89 to alt_modifier. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
90 Lisp_Object Vw32_alt_is_meta;
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
91
24339
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
92 /* If non-zero, the windows virtual key code for an alternative quit key. */
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
93 Lisp_Object Vw32_quit_key;
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
94
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
95 /* Non nil if left window key events are passed on to Windows (this only
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
96 affects whether "tapping" the key opens the Start menu). */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
97 Lisp_Object Vw32_pass_lwindow_to_system;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
98
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
99 /* Non nil if right window key events are passed on to Windows (this
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
100 only affects whether "tapping" the key opens the Start menu). */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
101 Lisp_Object Vw32_pass_rwindow_to_system;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
102
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
103 /* Virtual key code used to generate "phantom" key presses in order
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
104 to stop system from acting on Windows key events. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
105 Lisp_Object Vw32_phantom_key_code;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
106
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
107 /* Modifier associated with the left "Windows" key, or nil to act as a
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
108 normal key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
109 Lisp_Object Vw32_lwindow_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
110
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
111 /* Modifier associated with the right "Windows" key, or nil to act as a
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
112 normal key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
113 Lisp_Object Vw32_rwindow_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
114
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
115 /* Modifier associated with the "Apps" key, or nil to act as a normal
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
116 key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
117 Lisp_Object Vw32_apps_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
118
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
119 /* Value is nil if Num Lock acts as a function key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
120 Lisp_Object Vw32_enable_num_lock;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
121
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
122 /* Value is nil if Caps Lock acts as a function key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
123 Lisp_Object Vw32_enable_caps_lock;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
124
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
125 /* Modifier associated with Scroll Lock, or nil to act as a normal key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
126 Lisp_Object Vw32_scroll_lock_modifier;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
127
27894
6c4ff3519d09 (w32_wnd_proc) [WM_LBUTTON_DOWN, WM_RBUTTON_DOWN, WM_LBUTTON_UP,
Jason Rumney <jasonr@gnu.org>
parents: 27516
diff changeset
128 /* Switch to control whether we inhibit requests for synthesized bold
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
129 and italic versions of fonts. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
130 Lisp_Object Vw32_enable_synthesized_fonts;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
131
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
132 /* Enable palette management. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
133 Lisp_Object Vw32_enable_palette;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
134
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
135 /* Control how close left/right button down events must be to
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
136 be converted to a middle button down event. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
137 Lisp_Object Vw32_mouse_button_tolerance;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
138
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
139 /* Minimum interval between mouse movement (and scroll bar drag)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
140 events that are passed on to the event loop. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
141 Lisp_Object Vw32_mouse_move_interval;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
142
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
143 /* The name we're using in resource queries. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
144 Lisp_Object Vx_resource_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
145
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
146 /* Non nil if no window manager is in use. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
147 Lisp_Object Vx_no_window_manager;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
148
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
149 /* Non-zero means we're allowed to display a hourglass pointer. */
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
150
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
151 int display_hourglass_p;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
152
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
153 /* The background and shape of the mouse pointer, and shape when not
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
154 over text or in the modeline. */
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
155
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
156 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: 36080
diff changeset
157 Lisp_Object Vx_hourglass_pointer_shape, Vx_window_horizontal_drag_shape;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
158
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
159 /* The shape when over mouse-sensitive text. */
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
160
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
161 Lisp_Object Vx_sensitive_text_pointer_shape;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
162
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
163 /* Color of chars displayed in cursor box. */
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
164
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
165 Lisp_Object Vx_cursor_fore_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
166
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
167 /* Nonzero if using Windows. */
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
168
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
169 static int w32_in_use;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
170
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
171 /* Search path for bitmap files. */
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
172
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
173 Lisp_Object Vx_bitmap_file_path;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
174
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
175 /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
176
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
177 Lisp_Object Vx_pixel_size_width_font_regexp;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
178
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
179 /* Alist of bdf fonts and the files that define them. */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
180 Lisp_Object Vw32_bdf_filename_alist;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
181
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
182 Lisp_Object Vw32_system_coding_system;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
183
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
184 /* A flag to control whether fonts are matched strictly or not. */
24481
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
185 int w32_strict_fontnames;
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
186
24695
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
187 /* A flag to control whether we should only repaint if GetUpdateRect
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
188 indicates there is an update region. */
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
189 int w32_strict_painting;
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
190
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
191 /* Associative list linking character set strings to Windows codepages. */
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
192 Lisp_Object Vw32_charset_info_alist;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
193
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
194 /* VIETNAMESE_CHARSET is not defined in some versions of MSVC. */
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
195 #ifndef VIETNAMESE_CHARSET
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
196 #define VIETNAMESE_CHARSET 163
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
197 #endif
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
198
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
199 Lisp_Object Qauto_raise;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
200 Lisp_Object Qauto_lower;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
201 Lisp_Object Qbar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
202 Lisp_Object Qborder_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
203 Lisp_Object Qborder_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
204 Lisp_Object Qbox;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
205 Lisp_Object Qcursor_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
206 Lisp_Object Qcursor_type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
207 Lisp_Object Qgeometry;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
208 Lisp_Object Qicon_left;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
209 Lisp_Object Qicon_top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
210 Lisp_Object Qicon_type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
211 Lisp_Object Qicon_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
212 Lisp_Object Qinternal_border_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
213 Lisp_Object Qleft;
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
214 Lisp_Object Qright;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
215 Lisp_Object Qmouse_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
216 Lisp_Object Qnone;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
217 Lisp_Object Qparent_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
218 Lisp_Object Qscroll_bar_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
219 Lisp_Object Qsuppress_icon;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
220 Lisp_Object Qundefined_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
221 Lisp_Object Qvertical_scroll_bars;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
222 Lisp_Object Qvisibility;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
223 Lisp_Object Qwindow_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
224 Lisp_Object Qx_frame_parameter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
225 Lisp_Object Qx_resource_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
226 Lisp_Object Quser_position;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
227 Lisp_Object Quser_size;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
228 Lisp_Object Qscreen_gamma;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
229 Lisp_Object Qline_spacing;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
230 Lisp_Object Qcenter;
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
231 Lisp_Object Qcancel_timer;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
232 Lisp_Object Qhyper;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
233 Lisp_Object Qsuper;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
234 Lisp_Object Qmeta;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
235 Lisp_Object Qalt;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
236 Lisp_Object Qctrl;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
237 Lisp_Object Qcontrol;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
238 Lisp_Object Qshift;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
239
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
240 Lisp_Object Qw32_charset_ansi;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
241 Lisp_Object Qw32_charset_default;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
242 Lisp_Object Qw32_charset_symbol;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
243 Lisp_Object Qw32_charset_shiftjis;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
244 Lisp_Object Qw32_charset_hangeul;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
245 Lisp_Object Qw32_charset_gb2312;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
246 Lisp_Object Qw32_charset_chinesebig5;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
247 Lisp_Object Qw32_charset_oem;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
248
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
249 #ifndef JOHAB_CHARSET
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
250 #define JOHAB_CHARSET 130
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
251 #endif
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
252 #ifdef JOHAB_CHARSET
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
253 Lisp_Object Qw32_charset_easteurope;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
254 Lisp_Object Qw32_charset_turkish;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
255 Lisp_Object Qw32_charset_baltic;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
256 Lisp_Object Qw32_charset_russian;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
257 Lisp_Object Qw32_charset_arabic;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
258 Lisp_Object Qw32_charset_greek;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
259 Lisp_Object Qw32_charset_hebrew;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
260 Lisp_Object Qw32_charset_vietnamese;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
261 Lisp_Object Qw32_charset_thai;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
262 Lisp_Object Qw32_charset_johab;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
263 Lisp_Object Qw32_charset_mac;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
264 #endif
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
265
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
266 #ifdef UNICODE_CHARSET
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
267 Lisp_Object Qw32_charset_unicode;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
268 #endif
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
269
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
270 extern Lisp_Object Qtop;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
271 extern Lisp_Object Qdisplay;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
272 extern Lisp_Object Qtool_bar_lines;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
273
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
274 /* State variables for emulating a three button mouse. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
275 #define LMOUSE 1
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
276 #define MMOUSE 2
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
277 #define RMOUSE 4
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
278
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
279 static int button_state = 0;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
280 static W32Msg saved_mouse_button_msg;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
281 static unsigned mouse_button_timer; /* non-zero when timer is active */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
282 static W32Msg saved_mouse_move_msg;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
283 static unsigned mouse_move_timer;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
284
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
285 /* W95 mousewheel handler */
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
286 unsigned int msh_mousewheel = 0;
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
287
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
288 #define MOUSE_BUTTON_ID 1
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
289 #define MOUSE_MOVE_ID 2
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
290
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
291 /* The below are defined in frame.c. */
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
292
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
293 extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
294 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
295 extern Lisp_Object Qtool_bar_lines;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
296
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
297 extern Lisp_Object Vwindow_system_version;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
298
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
299 Lisp_Object Qface_set_after_frame_default;
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
300
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
301 #ifdef GLYPH_DEBUG
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
302 int image_cache_refcount, dpyinfo_refcount;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
303 #endif
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
304
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
305
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
306 /* From w32term.c. */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
307 extern Lisp_Object Vw32_num_mouse_buttons;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
308 extern Lisp_Object Vw32_recognize_altgr;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
309
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
310
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
311 /* Error if we are not connected to MS-Windows. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
312 void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
313 check_w32 ()
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
314 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
315 if (! w32_in_use)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
316 error ("MS-Windows not in use or not initialized");
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
317 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
318
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
319 /* Nonzero if we can use mouse menus.
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
320 You should not call this unless HAVE_MENUS is defined. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
321
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
322 int
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
323 have_menus_p ()
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
324 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
325 return w32_in_use;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
326 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
327
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
328 /* Extract a frame as a FRAME_PTR, defaulting to the selected frame
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
329 and checking validity for W32. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
330
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
331 FRAME_PTR
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
332 check_x_frame (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
333 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
334 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
335 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
336
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
337 if (NILP (frame))
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
338 frame = selected_frame;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
339 CHECK_LIVE_FRAME (frame, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
340 f = XFRAME (frame);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
341 if (! FRAME_W32_P (f))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
342 error ("non-w32 frame used");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
343 return f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
344 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
345
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
346 /* Let the user specify an display with a frame.
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
347 nil stands for the selected frame--or, if that is not a w32 frame,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
348 the first display on the list. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
349
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
350 static struct w32_display_info *
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
351 check_x_display_info (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
352 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
353 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
354 if (NILP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
355 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
356 struct frame *sf = XFRAME (selected_frame);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
357
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
358 if (FRAME_W32_P (sf) && FRAME_LIVE_P (sf))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
359 return FRAME_W32_DISPLAY_INFO (sf);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
360 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
361 return &one_w32_display_info;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
362 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
363 else if (STRINGP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
364 return x_display_info_for_name (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
365 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
366 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
367 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
368
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
369 CHECK_LIVE_FRAME (frame, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
370 f = XFRAME (frame);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
371 if (! FRAME_W32_P (f))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
372 error ("non-w32 frame used");
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
373 return FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
374 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
375 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
376
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
377 /* Return the Emacs frame-object corresponding to an w32 window.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
378 It could be the frame's main window or an icon window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
379
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
380 /* This function can be called during GC, so use GC_xxx type test macros. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
381
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
382 struct frame *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
383 x_window_to_frame (dpyinfo, wdesc)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
384 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
385 HWND wdesc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
386 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
387 Lisp_Object tail, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
388 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
389
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
390 for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
391 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
392 frame = XCAR (tail);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
393 if (!GC_FRAMEP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
394 continue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
395 f = XFRAME (frame);
26729
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25646
diff changeset
396 if (!FRAME_W32_P (f) || FRAME_W32_DISPLAY_INFO (f) != dpyinfo)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
397 continue;
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
398 if (f->output_data.w32->hourglass_window == wdesc)
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
399 return f;
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
400
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
401 /* TODO: Check tooltips when supported. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
402 if (FRAME_W32_WINDOW (f) == wdesc)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
403 return f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
404 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
405 return 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
406 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
407
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
408
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
409
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
410 /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
411 id, which is just an int that this section returns. Bitmaps are
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
412 reference counted so they can be shared among frames.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
413
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
414 Bitmap indices are guaranteed to be > 0, so a negative number can
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
415 be used to indicate no bitmap.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
416
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
417 If you use x_create_bitmap_from_data, then you must keep track of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
418 the bitmaps yourself. That is, creating a bitmap from the same
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
419 data more than once will not be caught. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
420
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
421
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
422 /* Functions to access the contents of a bitmap, given an id. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
423
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
424 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
425 x_bitmap_height (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
426 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
427 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
428 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
429 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].height;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
430 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
431
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
432 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
433 x_bitmap_width (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
434 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
435 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
436 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
437 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].width;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
438 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
439
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
440 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
441 x_bitmap_pixmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
442 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
443 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
444 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
445 return (int) FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
446 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
447
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
448
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
449 /* Allocate a new bitmap record. Returns index of new record. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
450
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
451 static int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
452 x_allocate_bitmap_record (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
453 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
454 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
455 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
456 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
457
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
458 if (dpyinfo->bitmaps == NULL)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
459 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
460 dpyinfo->bitmaps_size = 10;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
461 dpyinfo->bitmaps
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
462 = (struct w32_bitmap_record *) xmalloc (dpyinfo->bitmaps_size * sizeof (struct w32_bitmap_record));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
463 dpyinfo->bitmaps_last = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
464 return 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
465 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
466
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
467 if (dpyinfo->bitmaps_last < dpyinfo->bitmaps_size)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
468 return ++dpyinfo->bitmaps_last;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
469
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
470 for (i = 0; i < dpyinfo->bitmaps_size; ++i)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
471 if (dpyinfo->bitmaps[i].refcount == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
472 return i + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
473
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
474 dpyinfo->bitmaps_size *= 2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
475 dpyinfo->bitmaps
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
476 = (struct w32_bitmap_record *) xrealloc (dpyinfo->bitmaps,
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
477 dpyinfo->bitmaps_size * sizeof (struct w32_bitmap_record));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
478 return ++dpyinfo->bitmaps_last;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
479 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
480
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
481 /* Add one reference to the reference count of the bitmap with id ID. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
482
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
483 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
484 x_reference_bitmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
485 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
486 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
487 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
488 ++FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].refcount;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
489 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
490
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
491 /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
492
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
493 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
494 x_create_bitmap_from_data (f, bits, width, height)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
495 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
496 char *bits;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
497 unsigned int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
498 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
499 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
500 Pixmap bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
501 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
502
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
503 bitmap = CreateBitmap (width, height,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
504 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_planes,
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
505 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_cbits,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
506 bits);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
507
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
508 if (! bitmap)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
509 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
510
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
511 id = x_allocate_bitmap_record (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
512 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
513 dpyinfo->bitmaps[id - 1].file = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
514 dpyinfo->bitmaps[id - 1].hinst = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
515 dpyinfo->bitmaps[id - 1].refcount = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
516 dpyinfo->bitmaps[id - 1].depth = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
517 dpyinfo->bitmaps[id - 1].height = height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
518 dpyinfo->bitmaps[id - 1].width = width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
519
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
520 return id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
521 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
522
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
523 /* Create bitmap from file FILE for frame F. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
524
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
525 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
526 x_create_bitmap_from_file (f, file)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
527 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
528 Lisp_Object file;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
529 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
530 return -1;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
531 #if 0 /* TODO : bitmap support */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
532 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
533 unsigned int width, height;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
534 HBITMAP bitmap;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
535 int xhot, yhot, result, id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
536 Lisp_Object found;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
537 int fd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
538 char *filename;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
539 HINSTANCE hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
540
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
541 /* Look for an existing bitmap with the same name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
542 for (id = 0; id < dpyinfo->bitmaps_last; ++id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
543 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
544 if (dpyinfo->bitmaps[id].refcount
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
545 && dpyinfo->bitmaps[id].file
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
546 && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
547 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
548 ++dpyinfo->bitmaps[id].refcount;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
549 return id + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
550 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
551 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
552
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
553 /* Search bitmap-file-path for the file, if appropriate. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
554 fd = openp (Vx_bitmap_file_path, file, "", &found, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
555 if (fd < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
556 return -1;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
557 emacs_close (fd);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
558
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
559 filename = (char *) XSTRING (found)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
560
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
561 hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
562
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
563 if (hinst == NULL)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
564 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
565
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
566
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
567 result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
568 filename, &width, &height, &bitmap, &xhot, &yhot);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
569 if (result != BitmapSuccess)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
570 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
571
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
572 id = x_allocate_bitmap_record (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
573 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
574 dpyinfo->bitmaps[id - 1].refcount = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
575 dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
576 dpyinfo->bitmaps[id - 1].depth = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
577 dpyinfo->bitmaps[id - 1].height = height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
578 dpyinfo->bitmaps[id - 1].width = width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
579 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
580
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
581 return id;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
582 #endif /* TODO */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
583 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
584
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
585 /* Remove reference to bitmap with id number ID. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
586
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
587 void
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
588 x_destroy_bitmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
589 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
590 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
591 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
592 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
593
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
594 if (id > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
595 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
596 --dpyinfo->bitmaps[id - 1].refcount;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
597 if (dpyinfo->bitmaps[id - 1].refcount == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
598 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
599 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
600 DeleteObject (dpyinfo->bitmaps[id - 1].pixmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
601 if (dpyinfo->bitmaps[id - 1].file)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
602 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
603 xfree (dpyinfo->bitmaps[id - 1].file);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
604 dpyinfo->bitmaps[id - 1].file = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
605 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
606 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
607 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
608 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
609 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
610
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
611 /* Free all the bitmaps for the display specified by DPYINFO. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
612
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
613 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
614 x_destroy_all_bitmaps (dpyinfo)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
615 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
616 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
617 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
618 for (i = 0; i < dpyinfo->bitmaps_last; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
619 if (dpyinfo->bitmaps[i].refcount > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
620 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
621 DeleteObject (dpyinfo->bitmaps[i].pixmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
622 if (dpyinfo->bitmaps[i].file)
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
623 xfree (dpyinfo->bitmaps[i].file);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
624 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
625 dpyinfo->bitmaps_last = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
626 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
627
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
628 /* Connect the frame-parameter names for W32 frames
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
629 to the ways of passing the parameter values to the window system.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
630
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
631 The name of a parameter, as a Lisp symbol,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
632 has an `x-frame-parameter' property which is an integer in Lisp
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
633 but can be interpreted as an `enum x_frame_parm' in C. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
634
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
635 enum x_frame_parm
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
636 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
637 X_PARM_FOREGROUND_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
638 X_PARM_BACKGROUND_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
639 X_PARM_MOUSE_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
640 X_PARM_CURSOR_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
641 X_PARM_BORDER_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
642 X_PARM_ICON_TYPE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
643 X_PARM_FONT,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
644 X_PARM_BORDER_WIDTH,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
645 X_PARM_INTERNAL_BORDER_WIDTH,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
646 X_PARM_NAME,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
647 X_PARM_AUTORAISE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
648 X_PARM_AUTOLOWER,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
649 X_PARM_VERT_SCROLL_BAR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
650 X_PARM_VISIBILITY,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
651 X_PARM_MENU_BAR_LINES
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
652 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
653
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
654
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
655 struct x_frame_parm_table
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
656 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
657 char *name;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
658 void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
659 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
660
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
661 static Lisp_Object unwind_create_frame P_ ((Lisp_Object));
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
662 static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object));
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
663 static void x_change_window_heights P_ ((Lisp_Object, int));
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
664 /* TODO: Native Input Method support; see x_create_im. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
665 void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
666 static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object));
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
667 void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
668 void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
669 void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
670 void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
671 void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
672 void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
673 void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
674 void x_set_font P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
675 void x_set_border_width P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
676 void x_set_internal_border_width P_ ((struct frame *, Lisp_Object,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
677 Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
678 void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
679 void x_set_autoraise P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
680 void x_set_autolower P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
681 void x_set_vertical_scroll_bars P_ ((struct frame *, Lisp_Object,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
682 Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
683 void x_set_visibility P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
684 void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
685 void x_set_scroll_bar_width P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
686 void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
687 void x_set_unsplittable P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
688 void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
689 static void x_set_screen_gamma P_ ((struct frame *, Lisp_Object, Lisp_Object));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
690
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
691 static struct x_frame_parm_table x_frame_parms[] =
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
692 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
693 "auto-raise", x_set_autoraise,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
694 "auto-lower", x_set_autolower,
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
695 "background-color", x_set_background_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
696 "border-color", x_set_border_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
697 "border-width", x_set_border_width,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
698 "cursor-color", x_set_cursor_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
699 "cursor-type", x_set_cursor_type,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
700 "font", x_set_font,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
701 "foreground-color", x_set_foreground_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
702 "icon-name", x_set_icon_name,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
703 "icon-type", x_set_icon_type,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
704 "internal-border-width", x_set_internal_border_width,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
705 "menu-bar-lines", x_set_menu_bar_lines,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
706 "mouse-color", x_set_mouse_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
707 "name", x_explicitly_set_name,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
708 "scroll-bar-width", x_set_scroll_bar_width,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
709 "title", x_set_title,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
710 "unsplittable", x_set_unsplittable,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
711 "vertical-scroll-bars", x_set_vertical_scroll_bars,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
712 "visibility", x_set_visibility,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
713 "tool-bar-lines", x_set_tool_bar_lines,
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
714 "screen-gamma", x_set_screen_gamma,
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
715 "line-spacing", x_set_line_spacing
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
716 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
717
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
718 /* Attach the `x-frame-parameter' properties to
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
719 the Lisp symbol names of parameters relevant to W32. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
720
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
721 void
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
722 init_x_parm_symbols ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
723 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
724 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
725
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
726 for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
727 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
728 make_number (i));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
729 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
730
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
731 /* Change the parameters of frame F as specified by ALIST.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
732 If a parameter is not specially recognized, do nothing;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
733 otherwise call the `x_set_...' function for that parameter. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
734
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
735 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
736 x_set_frame_parameters (f, alist)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
737 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
738 Lisp_Object alist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
739 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
740 Lisp_Object tail;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
741
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
742 /* If both of these parameters are present, it's more efficient to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
743 set them both at once. So we wait until we've looked at the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
744 entire list before we set them. */
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
745 int width, height;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
746
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
747 /* Same here. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
748 Lisp_Object left, top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
749
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
750 /* Same with these. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
751 Lisp_Object icon_left, icon_top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
752
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
753 /* Record in these vectors all the parms specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
754 Lisp_Object *parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
755 Lisp_Object *values;
25289
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
756 int i, p;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
757 int left_no_change = 0, top_no_change = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
758 int icon_left_no_change = 0, icon_top_no_change = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
759
24211
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
760 struct gcpro gcpro1, gcpro2;
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
761
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
762 i = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
763 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
764 i++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
765
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
766 parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
767 values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
768
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
769 /* Extract parm names and values into those vectors. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
770
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
771 i = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
772 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
773 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
774 Lisp_Object elt;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
775
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
776 elt = Fcar (tail);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
777 parms[i] = Fcar (elt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
778 values[i] = Fcdr (elt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
779 i++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
780 }
24211
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
781 /* TAIL and ALIST are not used again below here. */
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
782 alist = tail = Qnil;
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
783
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
784 GCPRO2 (*parms, *values);
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
785 gcpro1.nvars = i;
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
786 gcpro2.nvars = i;
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
787
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
788 /* There is no need to gcpro LEFT, TOP, ICON_LEFT, or ICON_TOP,
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
789 because their values appear in VALUES and strings are not valid. */
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
790 top = left = Qunbound;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
791 icon_left = icon_top = Qunbound;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
792
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
793 /* Provide default values for HEIGHT and WIDTH. */
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
794 if (FRAME_NEW_WIDTH (f))
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
795 width = FRAME_NEW_WIDTH (f);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
796 else
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
797 width = FRAME_WIDTH (f);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
798
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
799 if (FRAME_NEW_HEIGHT (f))
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
800 height = FRAME_NEW_HEIGHT (f);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
801 else
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
802 height = FRAME_HEIGHT (f);
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
803
25289
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
804 /* Process foreground_color and background_color before anything else.
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
805 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: 25235
diff changeset
806 cursor_color) are dependent upon them. */
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
807 for (p = 0; p < i; p++)
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
808 {
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
809 Lisp_Object prop, val;
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
810
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
811 prop = parms[p];
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
812 val = values[p];
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
813 if (EQ (prop, Qforeground_color) || EQ (prop, Qbackground_color))
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
814 {
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
815 register Lisp_Object param_index, old_value;
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
816
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
817 param_index = Fget (prop, Qx_frame_parameter);
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
818 old_value = get_frame_param (f, prop);
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
819 store_frame_param (f, prop, val);
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
820 if (NATNUMP (param_index)
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
821 && (XFASTINT (param_index)
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
822 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])))
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
823 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value);
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
824 }
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
825 }
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
826
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
827 /* Now process them in reverse of specified order. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
828 for (i--; i >= 0; i--)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
829 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
830 Lisp_Object prop, val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
831
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
832 prop = parms[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
833 val = values[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
834
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
835 if (EQ (prop, Qwidth) && NUMBERP (val))
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
836 width = XFASTINT (val);
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
837 else if (EQ (prop, Qheight) && NUMBERP (val))
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
838 height = XFASTINT (val);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
839 else if (EQ (prop, Qtop))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
840 top = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
841 else if (EQ (prop, Qleft))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
842 left = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
843 else if (EQ (prop, Qicon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
844 icon_top = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
845 else if (EQ (prop, Qicon_left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
846 icon_left = val;
25289
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
847 else if (EQ (prop, Qforeground_color) || EQ (prop, Qbackground_color))
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
848 /* Processed above. */
64b742df49ca (x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents: 25235
diff changeset
849 continue;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
850 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
851 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
852 register Lisp_Object param_index, old_value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
853
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
854 param_index = Fget (prop, Qx_frame_parameter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
855 old_value = get_frame_param (f, prop);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
856 store_frame_param (f, prop, val);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
857 if (NATNUMP (param_index)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
858 && (XFASTINT (param_index)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
859 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
860 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
861 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
862 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
863
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
864 /* Don't die if just one of these was set. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
865 if (EQ (left, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
866 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
867 left_no_change = 1;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
868 if (f->output_data.w32->left_pos < 0)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
869 left = Fcons (Qplus, Fcons (make_number (f->output_data.w32->left_pos), Qnil));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
870 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
871 XSETINT (left, f->output_data.w32->left_pos);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
872 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
873 if (EQ (top, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
874 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
875 top_no_change = 1;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
876 if (f->output_data.w32->top_pos < 0)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
877 top = Fcons (Qplus, Fcons (make_number (f->output_data.w32->top_pos), Qnil));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
878 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
879 XSETINT (top, f->output_data.w32->top_pos);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
880 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
881
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
882 /* If one of the icon positions was not set, preserve or default it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
883 if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
884 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
885 icon_left_no_change = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
886 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
887 if (NILP (icon_left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
888 XSETINT (icon_left, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
889 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
890 if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
891 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
892 icon_top_no_change = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
893 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
894 if (NILP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
895 XSETINT (icon_top, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
896 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
897
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
898 /* Don't set these parameters unless they've been explicitly
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
899 specified. The window might be mapped or resized while we're in
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
900 this function, and we don't want to override that unless the lisp
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
901 code has asked for it.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
902
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
903 Don't set these parameters unless they actually differ from the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
904 window's current parameters; the window may not actually exist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
905 yet. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
906 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
907 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
908
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
909 check_frame_size (f, &height, &width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
910
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
911 XSETFRAME (frame, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
912
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
913 if (width != FRAME_WIDTH (f)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
914 || height != FRAME_HEIGHT (f)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
915 || FRAME_NEW_HEIGHT (f) || FRAME_NEW_WIDTH (f))
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
916 Fset_frame_size (frame, make_number (width), make_number (height));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
917
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
918 if ((!NILP (left) || !NILP (top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
919 && ! (left_no_change && top_no_change)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
920 && ! (NUMBERP (left) && XINT (left) == f->output_data.w32->left_pos
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
921 && NUMBERP (top) && XINT (top) == f->output_data.w32->top_pos))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
922 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
923 int leftpos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
924 int toppos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
925
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
926 /* Record the signs. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
927 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
928 if (EQ (left, Qminus))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
929 f->output_data.w32->size_hint_flags |= XNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
930 else if (INTEGERP (left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
931 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
932 leftpos = XINT (left);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
933 if (leftpos < 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
934 f->output_data.w32->size_hint_flags |= XNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
935 }
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
936 else if (CONSP (left) && EQ (XCAR (left), Qminus)
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
937 && CONSP (XCDR (left))
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
938 && INTEGERP (XCAR (XCDR (left))))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
939 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
940 leftpos = - XINT (XCAR (XCDR (left)));
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
941 f->output_data.w32->size_hint_flags |= XNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
942 }
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
943 else if (CONSP (left) && EQ (XCAR (left), Qplus)
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
944 && CONSP (XCDR (left))
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
945 && INTEGERP (XCAR (XCDR (left))))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
946 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
947 leftpos = XINT (XCAR (XCDR (left)));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
948 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
949
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
950 if (EQ (top, Qminus))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
951 f->output_data.w32->size_hint_flags |= YNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
952 else if (INTEGERP (top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
953 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
954 toppos = XINT (top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
955 if (toppos < 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
956 f->output_data.w32->size_hint_flags |= YNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
957 }
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
958 else if (CONSP (top) && EQ (XCAR (top), Qminus)
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
959 && CONSP (XCDR (top))
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
960 && INTEGERP (XCAR (XCDR (top))))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
961 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
962 toppos = - XINT (XCAR (XCDR (top)));
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
963 f->output_data.w32->size_hint_flags |= YNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
964 }
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
965 else if (CONSP (top) && EQ (XCAR (top), Qplus)
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
966 && CONSP (XCDR (top))
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
967 && INTEGERP (XCAR (XCDR (top))))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
968 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
969 toppos = XINT (XCAR (XCDR (top)));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
970 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
971
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
972
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
973 /* Store the numeric value of the position. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
974 f->output_data.w32->top_pos = toppos;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
975 f->output_data.w32->left_pos = leftpos;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
976
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
977 f->output_data.w32->win_gravity = NorthWestGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
978
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
979 /* Actually set that position, and convert to absolute. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
980 x_set_offset (f, leftpos, toppos, -1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
981 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
982
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
983 if ((!NILP (icon_left) || !NILP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
984 && ! (icon_left_no_change && icon_top_no_change))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
985 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
986 }
24211
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
987
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
988 UNGCPRO;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
989 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
990
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
991 /* Store the screen positions of frame F into XPTR and YPTR.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
992 These are the positions of the containing window manager window,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
993 not Emacs's own window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
994
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
995 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
996 x_real_positions (f, xptr, yptr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
997 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
998 int *xptr, *yptr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
999 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1000 POINT pt;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1001
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1002 {
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1003 RECT rect;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1004
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1005 GetClientRect(FRAME_W32_WINDOW(f), &rect);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1006 AdjustWindowRect(&rect, f->output_data.w32->dwStyle, FRAME_EXTERNAL_MENU_BAR(f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1007
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1008 pt.x = rect.left;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1009 pt.y = rect.top;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1010 }
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1011
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1012 ClientToScreen (FRAME_W32_WINDOW(f), &pt);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1013
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1014 *xptr = pt.x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1015 *yptr = pt.y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1016 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1017
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1018 /* Insert a description of internally-recorded parameters of frame X
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1019 into the parameter alist *ALISTPTR that is to be given to the user.
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1020 Only parameters that are specific to W32
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1021 and whose values are not correctly recorded in the frame's
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1022 param_alist need to be considered here. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1023
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1024 void
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1025 x_report_frame_params (f, alistptr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1026 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1027 Lisp_Object *alistptr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1028 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1029 char buf[16];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1030 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1031
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1032 /* Represent negative positions (off the top or left screen edge)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1033 in a way that Fmodify_frame_parameters will understand correctly. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1034 XSETINT (tem, f->output_data.w32->left_pos);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1035 if (f->output_data.w32->left_pos >= 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1036 store_in_alist (alistptr, Qleft, tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1037 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1038 store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1039
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1040 XSETINT (tem, f->output_data.w32->top_pos);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1041 if (f->output_data.w32->top_pos >= 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1042 store_in_alist (alistptr, Qtop, tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1043 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1044 store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1045
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1046 store_in_alist (alistptr, Qborder_width,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1047 make_number (f->output_data.w32->border_width));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1048 store_in_alist (alistptr, Qinternal_border_width,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1049 make_number (f->output_data.w32->internal_border_width));
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1050 sprintf (buf, "%ld", (long) FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1051 store_in_alist (alistptr, Qwindow_id,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1052 build_string (buf));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1053 store_in_alist (alistptr, Qicon_name, f->icon_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1054 FRAME_SAMPLE_VISIBILITY (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1055 store_in_alist (alistptr, Qvisibility,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1056 (FRAME_VISIBLE_P (f) ? Qt
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1057 : FRAME_ICONIFIED_P (f) ? Qicon : Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1058 store_in_alist (alistptr, Qdisplay,
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
1059 XCAR (FRAME_W32_DISPLAY_INFO (f)->name_list_element));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1060 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1061
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1062
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1063 DEFUN ("w32-define-rgb-color", Fw32_define_rgb_color, Sw32_define_rgb_color, 4, 4, 0,
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1064 "Convert RGB numbers to a windows color reference and associate with NAME (a string).\n\
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1065 This adds or updates a named color to w32-color-map, making it available for use.\n\
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1066 The original entry's RGB ref is returned, or nil if the entry is new.")
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1067 (red, green, blue, name)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1068 Lisp_Object red, green, blue, name;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1069 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1070 Lisp_Object rgb;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1071 Lisp_Object oldrgb = Qnil;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1072 Lisp_Object entry;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1073
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1074 CHECK_NUMBER (red, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1075 CHECK_NUMBER (green, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1076 CHECK_NUMBER (blue, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1077 CHECK_STRING (name, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1078
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1079 XSET (rgb, Lisp_Int, RGB(XUINT (red), XUINT (green), XUINT (blue)));
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1080
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1081 BLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1082
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1083 /* replace existing entry in w32-color-map or add new entry. */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1084 entry = Fassoc (name, Vw32_color_map);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1085 if (NILP (entry))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1086 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1087 entry = Fcons (name, rgb);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1088 Vw32_color_map = Fcons (entry, Vw32_color_map);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1089 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1090 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1091 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1092 oldrgb = Fcdr (entry);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1093 Fsetcdr (entry, rgb);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1094 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1095
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1096 UNBLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1097
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1098 return (oldrgb);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1099 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1100
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1101 DEFUN ("w32-load-color-file", Fw32_load_color_file, Sw32_load_color_file, 1, 1, 0,
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1102 "Create an alist of color entries from an external file (ie. rgb.txt).\n\
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1103 Assign this value to w32-color-map to replace the existing color map.\n\
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1104 \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1105 The file should define one named RGB color per line like so:\
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1106 R G B name\n\
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1107 where R,G,B are numbers between 0 and 255 and name is an arbitrary string.")
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1108 (filename)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1109 Lisp_Object filename;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1110 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1111 FILE *fp;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1112 Lisp_Object cmap = Qnil;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1113 Lisp_Object abspath;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1114
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1115 CHECK_STRING (filename, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1116 abspath = Fexpand_file_name (filename, Qnil);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1117
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1118 fp = fopen (XSTRING (filename)->data, "rt");
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1119 if (fp)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1120 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1121 char buf[512];
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1122 int red, green, blue;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1123 int num;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1124
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1125 BLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1126
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1127 while (fgets (buf, sizeof (buf), fp) != NULL) {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1128 if (sscanf (buf, "%u %u %u %n", &red, &green, &blue, &num) == 3)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1129 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1130 char *name = buf + num;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1131 num = strlen (name) - 1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1132 if (name[num] == '\n')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1133 name[num] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1134 cmap = Fcons (Fcons (build_string (name),
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1135 make_number (RGB (red, green, blue))),
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1136 cmap);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1137 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1138 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1139 fclose (fp);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1140
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1141 UNBLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1142 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1143
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1144 return cmap;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1145 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1146
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1147 /* The default colors for the w32 color map */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1148 typedef struct colormap_t
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1149 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1150 char *name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1151 COLORREF colorref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1152 } colormap_t;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1153
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1154 colormap_t w32_color_map[] =
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1155 {
14983
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1156 {"snow" , PALETTERGB (255,250,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1157 {"ghost white" , PALETTERGB (248,248,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1158 {"GhostWhite" , PALETTERGB (248,248,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1159 {"white smoke" , PALETTERGB (245,245,245)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1160 {"WhiteSmoke" , PALETTERGB (245,245,245)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1161 {"gainsboro" , PALETTERGB (220,220,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1162 {"floral white" , PALETTERGB (255,250,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1163 {"FloralWhite" , PALETTERGB (255,250,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1164 {"old lace" , PALETTERGB (253,245,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1165 {"OldLace" , PALETTERGB (253,245,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1166 {"linen" , PALETTERGB (250,240,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1167 {"antique white" , PALETTERGB (250,235,215)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1168 {"AntiqueWhite" , PALETTERGB (250,235,215)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1169 {"papaya whip" , PALETTERGB (255,239,213)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1170 {"PapayaWhip" , PALETTERGB (255,239,213)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1171 {"blanched almond" , PALETTERGB (255,235,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1172 {"BlanchedAlmond" , PALETTERGB (255,235,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1173 {"bisque" , PALETTERGB (255,228,196)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1174 {"peach puff" , PALETTERGB (255,218,185)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1175 {"PeachPuff" , PALETTERGB (255,218,185)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1176 {"navajo white" , PALETTERGB (255,222,173)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1177 {"NavajoWhite" , PALETTERGB (255,222,173)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1178 {"moccasin" , PALETTERGB (255,228,181)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1179 {"cornsilk" , PALETTERGB (255,248,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1180 {"ivory" , PALETTERGB (255,255,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1181 {"lemon chiffon" , PALETTERGB (255,250,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1182 {"LemonChiffon" , PALETTERGB (255,250,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1183 {"seashell" , PALETTERGB (255,245,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1184 {"honeydew" , PALETTERGB (240,255,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1185 {"mint cream" , PALETTERGB (245,255,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1186 {"MintCream" , PALETTERGB (245,255,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1187 {"azure" , PALETTERGB (240,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1188 {"alice blue" , PALETTERGB (240,248,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1189 {"AliceBlue" , PALETTERGB (240,248,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1190 {"lavender" , PALETTERGB (230,230,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1191 {"lavender blush" , PALETTERGB (255,240,245)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1192 {"LavenderBlush" , PALETTERGB (255,240,245)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1193 {"misty rose" , PALETTERGB (255,228,225)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1194 {"MistyRose" , PALETTERGB (255,228,225)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1195 {"white" , PALETTERGB (255,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1196 {"black" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1197 {"dark slate gray" , PALETTERGB ( 47, 79, 79)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1198 {"DarkSlateGray" , PALETTERGB ( 47, 79, 79)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1199 {"dark slate grey" , PALETTERGB ( 47, 79, 79)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1200 {"DarkSlateGrey" , PALETTERGB ( 47, 79, 79)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1201 {"dim gray" , PALETTERGB (105,105,105)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1202 {"DimGray" , PALETTERGB (105,105,105)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1203 {"dim grey" , PALETTERGB (105,105,105)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1204 {"DimGrey" , PALETTERGB (105,105,105)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1205 {"slate gray" , PALETTERGB (112,128,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1206 {"SlateGray" , PALETTERGB (112,128,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1207 {"slate grey" , PALETTERGB (112,128,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1208 {"SlateGrey" , PALETTERGB (112,128,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1209 {"light slate gray" , PALETTERGB (119,136,153)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1210 {"LightSlateGray" , PALETTERGB (119,136,153)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1211 {"light slate grey" , PALETTERGB (119,136,153)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1212 {"LightSlateGrey" , PALETTERGB (119,136,153)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1213 {"gray" , PALETTERGB (190,190,190)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1214 {"grey" , PALETTERGB (190,190,190)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1215 {"light grey" , PALETTERGB (211,211,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1216 {"LightGrey" , PALETTERGB (211,211,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1217 {"light gray" , PALETTERGB (211,211,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1218 {"LightGray" , PALETTERGB (211,211,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1219 {"midnight blue" , PALETTERGB ( 25, 25,112)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1220 {"MidnightBlue" , PALETTERGB ( 25, 25,112)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1221 {"navy" , PALETTERGB ( 0, 0,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1222 {"navy blue" , PALETTERGB ( 0, 0,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1223 {"NavyBlue" , PALETTERGB ( 0, 0,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1224 {"cornflower blue" , PALETTERGB (100,149,237)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1225 {"CornflowerBlue" , PALETTERGB (100,149,237)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1226 {"dark slate blue" , PALETTERGB ( 72, 61,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1227 {"DarkSlateBlue" , PALETTERGB ( 72, 61,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1228 {"slate blue" , PALETTERGB (106, 90,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1229 {"SlateBlue" , PALETTERGB (106, 90,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1230 {"medium slate blue" , PALETTERGB (123,104,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1231 {"MediumSlateBlue" , PALETTERGB (123,104,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1232 {"light slate blue" , PALETTERGB (132,112,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1233 {"LightSlateBlue" , PALETTERGB (132,112,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1234 {"medium blue" , PALETTERGB ( 0, 0,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1235 {"MediumBlue" , PALETTERGB ( 0, 0,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1236 {"royal blue" , PALETTERGB ( 65,105,225)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1237 {"RoyalBlue" , PALETTERGB ( 65,105,225)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1238 {"blue" , PALETTERGB ( 0, 0,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1239 {"dodger blue" , PALETTERGB ( 30,144,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1240 {"DodgerBlue" , PALETTERGB ( 30,144,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1241 {"deep sky blue" , PALETTERGB ( 0,191,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1242 {"DeepSkyBlue" , PALETTERGB ( 0,191,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1243 {"sky blue" , PALETTERGB (135,206,235)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1244 {"SkyBlue" , PALETTERGB (135,206,235)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1245 {"light sky blue" , PALETTERGB (135,206,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1246 {"LightSkyBlue" , PALETTERGB (135,206,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1247 {"steel blue" , PALETTERGB ( 70,130,180)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1248 {"SteelBlue" , PALETTERGB ( 70,130,180)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1249 {"light steel blue" , PALETTERGB (176,196,222)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1250 {"LightSteelBlue" , PALETTERGB (176,196,222)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1251 {"light blue" , PALETTERGB (173,216,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1252 {"LightBlue" , PALETTERGB (173,216,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1253 {"powder blue" , PALETTERGB (176,224,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1254 {"PowderBlue" , PALETTERGB (176,224,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1255 {"pale turquoise" , PALETTERGB (175,238,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1256 {"PaleTurquoise" , PALETTERGB (175,238,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1257 {"dark turquoise" , PALETTERGB ( 0,206,209)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1258 {"DarkTurquoise" , PALETTERGB ( 0,206,209)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1259 {"medium turquoise" , PALETTERGB ( 72,209,204)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1260 {"MediumTurquoise" , PALETTERGB ( 72,209,204)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1261 {"turquoise" , PALETTERGB ( 64,224,208)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1262 {"cyan" , PALETTERGB ( 0,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1263 {"light cyan" , PALETTERGB (224,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1264 {"LightCyan" , PALETTERGB (224,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1265 {"cadet blue" , PALETTERGB ( 95,158,160)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1266 {"CadetBlue" , PALETTERGB ( 95,158,160)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1267 {"medium aquamarine" , PALETTERGB (102,205,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1268 {"MediumAquamarine" , PALETTERGB (102,205,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1269 {"aquamarine" , PALETTERGB (127,255,212)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1270 {"dark green" , PALETTERGB ( 0,100, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1271 {"DarkGreen" , PALETTERGB ( 0,100, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1272 {"dark olive green" , PALETTERGB ( 85,107, 47)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1273 {"DarkOliveGreen" , PALETTERGB ( 85,107, 47)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1274 {"dark sea green" , PALETTERGB (143,188,143)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1275 {"DarkSeaGreen" , PALETTERGB (143,188,143)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1276 {"sea green" , PALETTERGB ( 46,139, 87)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1277 {"SeaGreen" , PALETTERGB ( 46,139, 87)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1278 {"medium sea green" , PALETTERGB ( 60,179,113)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1279 {"MediumSeaGreen" , PALETTERGB ( 60,179,113)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1280 {"light sea green" , PALETTERGB ( 32,178,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1281 {"LightSeaGreen" , PALETTERGB ( 32,178,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1282 {"pale green" , PALETTERGB (152,251,152)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1283 {"PaleGreen" , PALETTERGB (152,251,152)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1284 {"spring green" , PALETTERGB ( 0,255,127)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1285 {"SpringGreen" , PALETTERGB ( 0,255,127)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1286 {"lawn green" , PALETTERGB (124,252, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1287 {"LawnGreen" , PALETTERGB (124,252, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1288 {"green" , PALETTERGB ( 0,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1289 {"chartreuse" , PALETTERGB (127,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1290 {"medium spring green" , PALETTERGB ( 0,250,154)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1291 {"MediumSpringGreen" , PALETTERGB ( 0,250,154)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1292 {"green yellow" , PALETTERGB (173,255, 47)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1293 {"GreenYellow" , PALETTERGB (173,255, 47)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1294 {"lime green" , PALETTERGB ( 50,205, 50)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1295 {"LimeGreen" , PALETTERGB ( 50,205, 50)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1296 {"yellow green" , PALETTERGB (154,205, 50)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1297 {"YellowGreen" , PALETTERGB (154,205, 50)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1298 {"forest green" , PALETTERGB ( 34,139, 34)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1299 {"ForestGreen" , PALETTERGB ( 34,139, 34)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1300 {"olive drab" , PALETTERGB (107,142, 35)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1301 {"OliveDrab" , PALETTERGB (107,142, 35)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1302 {"dark khaki" , PALETTERGB (189,183,107)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1303 {"DarkKhaki" , PALETTERGB (189,183,107)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1304 {"khaki" , PALETTERGB (240,230,140)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1305 {"pale goldenrod" , PALETTERGB (238,232,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1306 {"PaleGoldenrod" , PALETTERGB (238,232,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1307 {"light goldenrod yellow" , PALETTERGB (250,250,210)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1308 {"LightGoldenrodYellow" , PALETTERGB (250,250,210)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1309 {"light yellow" , PALETTERGB (255,255,224)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1310 {"LightYellow" , PALETTERGB (255,255,224)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1311 {"yellow" , PALETTERGB (255,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1312 {"gold" , PALETTERGB (255,215, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1313 {"light goldenrod" , PALETTERGB (238,221,130)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1314 {"LightGoldenrod" , PALETTERGB (238,221,130)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1315 {"goldenrod" , PALETTERGB (218,165, 32)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1316 {"dark goldenrod" , PALETTERGB (184,134, 11)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1317 {"DarkGoldenrod" , PALETTERGB (184,134, 11)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1318 {"rosy brown" , PALETTERGB (188,143,143)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1319 {"RosyBrown" , PALETTERGB (188,143,143)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1320 {"indian red" , PALETTERGB (205, 92, 92)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1321 {"IndianRed" , PALETTERGB (205, 92, 92)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1322 {"saddle brown" , PALETTERGB (139, 69, 19)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1323 {"SaddleBrown" , PALETTERGB (139, 69, 19)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1324 {"sienna" , PALETTERGB (160, 82, 45)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1325 {"peru" , PALETTERGB (205,133, 63)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1326 {"burlywood" , PALETTERGB (222,184,135)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1327 {"beige" , PALETTERGB (245,245,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1328 {"wheat" , PALETTERGB (245,222,179)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1329 {"sandy brown" , PALETTERGB (244,164, 96)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1330 {"SandyBrown" , PALETTERGB (244,164, 96)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1331 {"tan" , PALETTERGB (210,180,140)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1332 {"chocolate" , PALETTERGB (210,105, 30)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1333 {"firebrick" , PALETTERGB (178,34, 34)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1334 {"brown" , PALETTERGB (165,42, 42)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1335 {"dark salmon" , PALETTERGB (233,150,122)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1336 {"DarkSalmon" , PALETTERGB (233,150,122)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1337 {"salmon" , PALETTERGB (250,128,114)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1338 {"light salmon" , PALETTERGB (255,160,122)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1339 {"LightSalmon" , PALETTERGB (255,160,122)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1340 {"orange" , PALETTERGB (255,165, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1341 {"dark orange" , PALETTERGB (255,140, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1342 {"DarkOrange" , PALETTERGB (255,140, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1343 {"coral" , PALETTERGB (255,127, 80)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1344 {"light coral" , PALETTERGB (240,128,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1345 {"LightCoral" , PALETTERGB (240,128,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1346 {"tomato" , PALETTERGB (255, 99, 71)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1347 {"orange red" , PALETTERGB (255, 69, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1348 {"OrangeRed" , PALETTERGB (255, 69, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1349 {"red" , PALETTERGB (255, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1350 {"hot pink" , PALETTERGB (255,105,180)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1351 {"HotPink" , PALETTERGB (255,105,180)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1352 {"deep pink" , PALETTERGB (255, 20,147)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1353 {"DeepPink" , PALETTERGB (255, 20,147)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1354 {"pink" , PALETTERGB (255,192,203)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1355 {"light pink" , PALETTERGB (255,182,193)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1356 {"LightPink" , PALETTERGB (255,182,193)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1357 {"pale violet red" , PALETTERGB (219,112,147)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1358 {"PaleVioletRed" , PALETTERGB (219,112,147)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1359 {"maroon" , PALETTERGB (176, 48, 96)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1360 {"medium violet red" , PALETTERGB (199, 21,133)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1361 {"MediumVioletRed" , PALETTERGB (199, 21,133)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1362 {"violet red" , PALETTERGB (208, 32,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1363 {"VioletRed" , PALETTERGB (208, 32,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1364 {"magenta" , PALETTERGB (255, 0,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1365 {"violet" , PALETTERGB (238,130,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1366 {"plum" , PALETTERGB (221,160,221)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1367 {"orchid" , PALETTERGB (218,112,214)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1368 {"medium orchid" , PALETTERGB (186, 85,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1369 {"MediumOrchid" , PALETTERGB (186, 85,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1370 {"dark orchid" , PALETTERGB (153, 50,204)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1371 {"DarkOrchid" , PALETTERGB (153, 50,204)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1372 {"dark violet" , PALETTERGB (148, 0,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1373 {"DarkViolet" , PALETTERGB (148, 0,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1374 {"blue violet" , PALETTERGB (138, 43,226)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1375 {"BlueViolet" , PALETTERGB (138, 43,226)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1376 {"purple" , PALETTERGB (160, 32,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1377 {"medium purple" , PALETTERGB (147,112,219)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1378 {"MediumPurple" , PALETTERGB (147,112,219)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1379 {"thistle" , PALETTERGB (216,191,216)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1380 {"gray0" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1381 {"grey0" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1382 {"dark grey" , PALETTERGB (169,169,169)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1383 {"DarkGrey" , PALETTERGB (169,169,169)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1384 {"dark gray" , PALETTERGB (169,169,169)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1385 {"DarkGray" , PALETTERGB (169,169,169)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1386 {"dark blue" , PALETTERGB ( 0, 0,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1387 {"DarkBlue" , PALETTERGB ( 0, 0,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1388 {"dark cyan" , PALETTERGB ( 0,139,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1389 {"DarkCyan" , PALETTERGB ( 0,139,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1390 {"dark magenta" , PALETTERGB (139, 0,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1391 {"DarkMagenta" , PALETTERGB (139, 0,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1392 {"dark red" , PALETTERGB (139, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1393 {"DarkRed" , PALETTERGB (139, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1394 {"light green" , PALETTERGB (144,238,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1395 {"LightGreen" , PALETTERGB (144,238,144)},
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1396 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1397
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1398 DEFUN ("w32-default-color-map", Fw32_default_color_map, Sw32_default_color_map,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1399 0, 0, 0, "Return the default color map.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1400 ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1401 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1402 int i;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1403 colormap_t *pc = w32_color_map;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1404 Lisp_Object cmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1405
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1406 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1407
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1408 cmap = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1409
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1410 for (i = 0; i < sizeof (w32_color_map) / sizeof (w32_color_map[0]);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1411 pc++, i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1412 cmap = Fcons (Fcons (build_string (pc->name),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1413 make_number (pc->colorref)),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1414 cmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1415
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1416 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1417
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1418 return (cmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1419 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1420
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1421 Lisp_Object
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1422 w32_to_x_color (rgb)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1423 Lisp_Object rgb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1424 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1425 Lisp_Object color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1426
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1427 CHECK_NUMBER (rgb, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1428
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1429 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1430
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1431 color = Frassq (rgb, Vw32_color_map);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1432
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1433 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1435 if (!NILP (color))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1436 return (Fcar (color));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1437 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1438 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1439 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1440
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1441 COLORREF
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1442 w32_color_map_lookup (colorname)
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1443 char *colorname;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1444 {
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1445 Lisp_Object tail, ret = Qnil;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1446
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1447 BLOCK_INPUT;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1448
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1449 for (tail = Vw32_color_map; !NILP (tail); tail = Fcdr (tail))
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1450 {
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1451 register Lisp_Object elt, tem;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1452
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1453 elt = Fcar (tail);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1454 if (!CONSP (elt)) continue;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1455
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1456 tem = Fcar (elt);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1457
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1458 if (lstrcmpi (XSTRING (tem)->data, colorname) == 0)
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1459 {
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1460 ret = XUINT (Fcdr (elt));
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1461 break;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1462 }
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1463
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1464 QUIT;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1465 }
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1466
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1467
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1468 UNBLOCK_INPUT;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1469
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1470 return ret;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1471 }
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1472
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1473 COLORREF
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1474 x_to_w32_color (colorname)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1475 char * colorname;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1476 {
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
1477 register Lisp_Object ret = Qnil;
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
1478
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1479 BLOCK_INPUT;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1480
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1481 if (colorname[0] == '#')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1482 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1483 /* Could be an old-style RGB Device specification. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1484 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1485 int size;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1486 color = colorname + 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1487
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1488 size = strlen(color);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1489 if (size == 3 || size == 6 || size == 9 || size == 12)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1490 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1491 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1492 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1493 pos = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1494 size /= 3;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1495 colorval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1496
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1497 for (i = 0; i < 3; i++)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1498 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1499 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1500 char t;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1501 unsigned long value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1502
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1503 /* The check for 'x' in the following conditional takes into
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1504 account the fact that strtol allows a "0x" in front of
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1505 our numbers, and we don't. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1506 if (!isxdigit(color[0]) || color[1] == 'x')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1507 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1508 t = color[size];
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1509 color[size] = '\0';
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1510 value = strtoul(color, &end, 16);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1511 color[size] = t;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1512 if (errno == ERANGE || end - color != size)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1513 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1514 switch (size)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1515 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1516 case 1:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1517 value = value * 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1518 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1519 case 2:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1520 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1521 case 3:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1522 value /= 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1523 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1524 case 4:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1525 value /= 0x100;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1526 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1527 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1528 colorval |= (value << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1529 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1530 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1531 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1532 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1533 return (colorval);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1534 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1535 color = end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1536 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1537 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1538 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1539 else if (strnicmp(colorname, "rgb:", 4) == 0)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1540 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1541 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1542 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1543 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1544 pos = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1545
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1546 colorval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1547 color = colorname + 4;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1548 for (i = 0; i < 3; i++)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1549 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1550 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1551 unsigned long value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1552
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1553 /* The check for 'x' in the following conditional takes into
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1554 account the fact that strtol allows a "0x" in front of
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1555 our numbers, and we don't. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1556 if (!isxdigit(color[0]) || color[1] == 'x')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1557 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1558 value = strtoul(color, &end, 16);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1559 if (errno == ERANGE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1560 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1561 switch (end - color)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1562 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1563 case 1:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1564 value = value * 0x10 + value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1565 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1566 case 2:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1567 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1568 case 3:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1569 value /= 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1570 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1571 case 4:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1572 value /= 0x100;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1573 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1574 default:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1575 value = ULONG_MAX;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1576 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1577 if (value == ULONG_MAX)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1578 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1579 colorval |= (value << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1580 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1581 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1582 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1583 if (*end != '\0')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1584 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1585 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1586 return (colorval);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1587 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1588 if (*end != '/')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1589 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1590 color = end + 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1591 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1592 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1593 else if (strnicmp(colorname, "rgbi:", 5) == 0)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1594 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1595 /* This is an RGB Intensity specification. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1596 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1597 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1598 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1599 pos = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1600
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1601 colorval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1602 color = colorname + 5;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1603 for (i = 0; i < 3; i++)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1604 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1605 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1606 double value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1607 UINT val;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1608
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1609 value = strtod(color, &end);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1610 if (errno == ERANGE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1611 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1612 if (value < 0.0 || value > 1.0)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1613 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1614 val = (UINT)(0x100 * value);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1615 /* We used 0x100 instead of 0xFF to give an continuous
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1616 range between 0.0 and 1.0 inclusive. The next statement
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1617 fixes the 1.0 case. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1618 if (val == 0x100)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1619 val = 0xFF;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1620 colorval |= (val << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1621 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1622 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1623 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1624 if (*end != '\0')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1625 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1626 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1627 return (colorval);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1628 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1629 if (*end != '/')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1630 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1631 color = end + 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1632 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1633 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1634 /* I am not going to attempt to handle any of the CIE color schemes
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1635 or TekHVC, since I don't know the algorithms for conversion to
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1636 RGB. */
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1637
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1638 /* If we fail to lookup the color name in w32_color_map, then check the
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1639 colorname to see if it can be crudely approximated: If the X color
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1640 ends in a number (e.g., "darkseagreen2"), strip the number and
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1641 return the result of looking up the base color name. */
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1642 ret = w32_color_map_lookup (colorname);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1643 if (NILP (ret))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1644 {
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1645 int len = strlen (colorname);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1646
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1647 if (isdigit (colorname[len - 1]))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1648 {
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1649 char *ptr, *approx = alloca (len);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1650
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1651 strcpy (approx, colorname);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1652 ptr = &approx[len - 1];
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1653 while (ptr > approx && isdigit (*ptr))
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1654 *ptr-- = '\0';
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1655
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1656 ret = w32_color_map_lookup (approx);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1657 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1658 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1659
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1660 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1661 return ret;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1662 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1663
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1664
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1665 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1666 w32_regenerate_palette (FRAME_PTR f)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1667 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1668 struct w32_palette_entry * list;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1669 LOGPALETTE * log_palette;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1670 HPALETTE new_palette;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1671 int i;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1672
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1673 /* don't bother trying to create palette if not supported */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1674 if (! FRAME_W32_DISPLAY_INFO (f)->has_palette)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1675 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1676
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1677 log_palette = (LOGPALETTE *)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1678 alloca (sizeof (LOGPALETTE) +
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1679 FRAME_W32_DISPLAY_INFO (f)->num_colors * sizeof (PALETTEENTRY));
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1680 log_palette->palVersion = 0x300;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1681 log_palette->palNumEntries = FRAME_W32_DISPLAY_INFO (f)->num_colors;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1682
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1683 list = FRAME_W32_DISPLAY_INFO (f)->color_list;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1684 for (i = 0;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1685 i < FRAME_W32_DISPLAY_INFO (f)->num_colors;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1686 i++, list = list->next)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1687 log_palette->palPalEntry[i] = list->entry;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1688
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1689 new_palette = CreatePalette (log_palette);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1690
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1691 enter_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1692
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1693 if (FRAME_W32_DISPLAY_INFO (f)->palette)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1694 DeleteObject (FRAME_W32_DISPLAY_INFO (f)->palette);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1695 FRAME_W32_DISPLAY_INFO (f)->palette = new_palette;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1696
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1697 /* Realize display palette and garbage all frames. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1698 release_frame_dc (f, get_frame_dc (f));
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1699
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1700 leave_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1701 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1702
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1703 #define W32_COLOR(pe) RGB (pe.peRed, pe.peGreen, pe.peBlue)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1704 #define SET_W32_COLOR(pe, color) \
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1705 do \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1706 { \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1707 pe.peRed = GetRValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1708 pe.peGreen = GetGValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1709 pe.peBlue = GetBValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1710 pe.peFlags = 0; \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1711 } while (0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1712
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1713 #if 0
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1714 /* Keep these around in case we ever want to track color usage. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1715 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1716 w32_map_color (FRAME_PTR f, COLORREF color)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1717 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1718 struct w32_palette_entry * list = FRAME_W32_DISPLAY_INFO (f)->color_list;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1719
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1720 if (NILP (Vw32_enable_palette))
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1721 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1722
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1723 /* check if color is already mapped */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1724 while (list)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1725 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1726 if (W32_COLOR (list->entry) == color)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1727 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1728 ++list->refcount;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1729 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1730 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1731 list = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1732 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1733
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1734 /* not already mapped, so add to list and recreate Windows palette */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1735 list = (struct w32_palette_entry *)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1736 xmalloc (sizeof (struct w32_palette_entry));
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1737 SET_W32_COLOR (list->entry, color);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1738 list->refcount = 1;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1739 list->next = FRAME_W32_DISPLAY_INFO (f)->color_list;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1740 FRAME_W32_DISPLAY_INFO (f)->color_list = list;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1741 FRAME_W32_DISPLAY_INFO (f)->num_colors++;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1742
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1743 /* set flag that palette must be regenerated */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1744 FRAME_W32_DISPLAY_INFO (f)->regen_palette = TRUE;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1745 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1746
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1747 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1748 w32_unmap_color (FRAME_PTR f, COLORREF color)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1749 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1750 struct w32_palette_entry * list = FRAME_W32_DISPLAY_INFO (f)->color_list;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1751 struct w32_palette_entry **prev = &FRAME_W32_DISPLAY_INFO (f)->color_list;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1752
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1753 if (NILP (Vw32_enable_palette))
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1754 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1755
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1756 /* check if color is already mapped */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1757 while (list)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1758 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1759 if (W32_COLOR (list->entry) == color)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1760 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1761 if (--list->refcount == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1762 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1763 *prev = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1764 xfree (list);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1765 FRAME_W32_DISPLAY_INFO (f)->num_colors--;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1766 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1767 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1768 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1769 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1770 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1771 prev = &list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1772 list = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1773 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1774
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1775 /* set flag that palette must be regenerated */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1776 FRAME_W32_DISPLAY_INFO (f)->regen_palette = TRUE;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1777 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1778 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1779
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1780
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1781 /* Gamma-correct COLOR on frame F. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1782
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1783 void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1784 gamma_correct (f, color)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1785 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1786 COLORREF *color;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1787 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1788 if (f->gamma)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1789 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1790 *color = PALETTERGB (
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1791 pow (GetRValue (*color) / 255.0, f->gamma) * 255.0 + 0.5,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1792 pow (GetGValue (*color) / 255.0, f->gamma) * 255.0 + 0.5,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1793 pow (GetBValue (*color) / 255.0, f->gamma) * 255.0 + 0.5);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1794 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1795 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1796
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1797
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1798 /* Decide if color named COLOR is valid for the display associated with
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1799 the selected frame; if so, return the rgb values in COLOR_DEF.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1800 If ALLOC is nonzero, allocate a new colormap cell. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1801
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1802 int
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1803 w32_defined_color (f, color, color_def, alloc)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1804 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1805 char *color;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1806 XColor *color_def;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1807 int alloc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1808 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1809 register Lisp_Object tem;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1810 COLORREF w32_color_ref;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1811
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1812 tem = x_to_w32_color (color);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1813
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1814 if (!NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1815 {
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1816 if (f)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1817 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1818 /* Apply gamma correction. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1819 w32_color_ref = XUINT (tem);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1820 gamma_correct (f, &w32_color_ref);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1821 XSETINT (tem, w32_color_ref);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1822 }
27407
7df920562cbe (w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents: 27397
diff changeset
1823
7df920562cbe (w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents: 27397
diff changeset
1824 /* Map this color to the palette if it is enabled. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1825 if (!NILP (Vw32_enable_palette))
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1826 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1827 struct w32_palette_entry * entry =
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1828 one_w32_display_info.color_list;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1829 struct w32_palette_entry ** prev =
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1830 &one_w32_display_info.color_list;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1831
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1832 /* check if color is already mapped */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1833 while (entry)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1834 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1835 if (W32_COLOR (entry->entry) == XUINT (tem))
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1836 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1837 prev = &entry->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1838 entry = entry->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1839 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1840
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1841 if (entry == NULL && alloc)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1842 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1843 /* not already mapped, so add to list */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1844 entry = (struct w32_palette_entry *)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1845 xmalloc (sizeof (struct w32_palette_entry));
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1846 SET_W32_COLOR (entry->entry, XUINT (tem));
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1847 entry->next = NULL;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1848 *prev = entry;
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1849 one_w32_display_info.num_colors++;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1850
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1851 /* set flag that palette must be regenerated */
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1852 one_w32_display_info.regen_palette = TRUE;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1853 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1854 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1855 /* Ensure COLORREF value is snapped to nearest color in (default)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1856 palette by simulating the PALETTERGB macro. This works whether
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1857 or not the display device has a palette. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1858 w32_color_ref = XUINT (tem) | 0x2000000;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1859
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1860 color_def->pixel = w32_color_ref;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1861 color_def->red = GetRValue (w32_color_ref);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1862 color_def->green = GetGValue (w32_color_ref);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1863 color_def->blue = GetBValue (w32_color_ref);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1864
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1865 return 1;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1866 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1867 else
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1868 {
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1869 return 0;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1870 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1871 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1872
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1873 /* Given a string ARG naming a color, compute a pixel value from it
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1874 suitable for screen F.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1875 If F is not a color screen, return DEF (default) regardless of what
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1876 ARG says. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1877
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1878 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1879 x_decode_color (f, arg, def)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1880 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1881 Lisp_Object arg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1882 int def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1883 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1884 XColor cdef;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1885
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1886 CHECK_STRING (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1887
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1888 if (strcmp (XSTRING (arg)->data, "black") == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1889 return BLACK_PIX_DEFAULT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1890 else if (strcmp (XSTRING (arg)->data, "white") == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1891 return WHITE_PIX_DEFAULT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1892
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1893 if ((FRAME_W32_DISPLAY_INFO (f)->n_planes * FRAME_W32_DISPLAY_INFO (f)->n_cbits) == 1)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1894 return def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1895
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1896 /* w32_defined_color is responsible for coping with failures
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1897 by looking for a near-miss. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1898 if (w32_defined_color (f, XSTRING (arg)->data, &cdef, 1))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1899 return cdef.pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1900
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1901 /* defined_color failed; return an ultimate default. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1902 return def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1903 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1904
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1905 /* Change the `line-spacing' frame parameter of frame F. OLD_VALUE is
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1906 the previous value of that parameter, NEW_VALUE is the new value. */
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1907
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1908 static void
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1909 x_set_line_spacing (f, new_value, old_value)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1910 struct frame *f;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1911 Lisp_Object new_value, old_value;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1912 {
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1913 if (NILP (new_value))
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1914 f->extra_line_spacing = 0;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1915 else if (NATNUMP (new_value))
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1916 f->extra_line_spacing = XFASTINT (new_value);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1917 else
30601
7c995a54a0e8 Replace `illegal' with `invalid'.
Gerd Moellmann <gerd@gnu.org>
parents: 30239
diff changeset
1918 Fsignal (Qerror, Fcons (build_string ("Invalid line-spacing"),
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1919 Fcons (new_value, Qnil)));
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1920 if (FRAME_VISIBLE_P (f))
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1921 redraw_frame (f);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1922 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1923
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1924
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1925 /* Change the `screen-gamma' frame parameter of frame F. OLD_VALUE is
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1926 the previous value of that parameter, NEW_VALUE is the new value. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1927
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1928 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1929 x_set_screen_gamma (f, new_value, old_value)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1930 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1931 Lisp_Object new_value, old_value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1932 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1933 if (NILP (new_value))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1934 f->gamma = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1935 else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1936 /* The value 0.4545 is the normal viewing gamma. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1937 f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1938 else
30601
7c995a54a0e8 Replace `illegal' with `invalid'.
Gerd Moellmann <gerd@gnu.org>
parents: 30239
diff changeset
1939 Fsignal (Qerror, Fcons (build_string ("Invalid screen-gamma"),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1940 Fcons (new_value, Qnil)));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1941
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1942 clear_face_cache (0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1943 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1944
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1945
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1946 /* Functions called only from `x_set_frame_param'
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1947 to set individual parameters.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1948
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1949 If FRAME_W32_WINDOW (f) is 0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1950 the frame is being created and its window does not exist yet.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1951 In that case, just record the parameter's new value
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1952 in the standard place; do not attempt to change the window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1953
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1954 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1955 x_set_foreground_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1956 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1957 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1958 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1959 FRAME_FOREGROUND_PIXEL (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1960 = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1961
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1962 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1963 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1964 update_face_from_frame_parameter (f, Qforeground_color, arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1965 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1966 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1967 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1968 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1969
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1970 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1971 x_set_background_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1972 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1973 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1974 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1975 FRAME_BACKGROUND_PIXEL (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1976 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1977
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1978 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1979 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1980 SetWindowLong (FRAME_W32_WINDOW (f), WND_BACKGROUND_INDEX,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1981 FRAME_BACKGROUND_PIXEL (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1982
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1983 update_face_from_frame_parameter (f, Qbackground_color, arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1984
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1985 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1986 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1987 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1988 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1989
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1990 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1991 x_set_mouse_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1992 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1993 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1994 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1995 Cursor cursor, nontext_cursor, mode_cursor, cross_cursor;
17632
d2915156a803 (x_set_mouse_color): Update calls to x_catch_errors
Richard M. Stallman <rms@gnu.org>
parents: 16884
diff changeset
1996 int count;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1997 int mask_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1998
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1999 if (!EQ (Qnil, arg))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2000 f->output_data.w32->mouse_pixel
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2001 = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2002 mask_color = FRAME_BACKGROUND_PIXEL (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2003
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2004 /* Don't let pointers be invisible. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2005 if (mask_color == f->output_data.w32->mouse_pixel
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2006 && mask_color == FRAME_BACKGROUND_PIXEL (f))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2007 f->output_data.w32->mouse_pixel = FRAME_FOREGROUND_PIXEL (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2008
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
2009 #if 0 /* TODO : cursor changes */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2010 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2011
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2012 /* It's not okay to crash if the user selects a screwy cursor. */
17632
d2915156a803 (x_set_mouse_color): Update calls to x_catch_errors
Richard M. Stallman <rms@gnu.org>
parents: 16884
diff changeset
2013 count = x_catch_errors (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2014
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2015 if (!EQ (Qnil, Vx_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2016 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2017 CHECK_NUMBER (Vx_pointer_shape, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2018 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XINT (Vx_pointer_shape));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2019 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2020 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2021 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_xterm);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2022 x_check_errors (FRAME_W32_DISPLAY (f), "bad text pointer cursor: %s");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2023
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2024 if (!EQ (Qnil, Vx_nontext_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2025 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2026 CHECK_NUMBER (Vx_nontext_pointer_shape, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2027 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2028 XINT (Vx_nontext_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2029 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2030 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2031 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_left_ptr);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2032 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2033
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
2034 if (!EQ (Qnil, Vx_hourglass_pointer_shape))
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
2035 {
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
2036 CHECK_NUMBER (Vx_hourglass_pointer_shape, 0);
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
2037 hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
2038 XINT (Vx_hourglass_pointer_shape));
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
2039 }
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
2040 else
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
2041 hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2042 x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2043
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2044 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2045 if (!EQ (Qnil, Vx_mode_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2046 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2047 CHECK_NUMBER (Vx_mode_pointer_shape, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2048 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2049 XINT (Vx_mode_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2050 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2051 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2052 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_xterm);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2053 x_check_errors (FRAME_W32_DISPLAY (f), "bad modeline pointer cursor: %s");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2054
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2055 if (!EQ (Qnil, Vx_sensitive_text_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2056 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2057 CHECK_NUMBER (Vx_sensitive_text_pointer_shape, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2058 cross_cursor
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2059 = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2060 XINT (Vx_sensitive_text_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2061 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2062 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2063 cross_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_crosshair);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2064
34133
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
2065 if (!NILP (Vx_window_horizontal_drag_shape))
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
2066 {
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
2067 CHECK_NUMBER (Vx_window_horizontal_drag_shape, 0);
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
2068 horizontal_drag_cursor
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
2069 = XCreateFontCursor (FRAME_X_DISPLAY (f),
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
2070 XINT (Vx_window_horizontal_drag_shape));
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
2071 }
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
2072 else
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
2073 horizontal_drag_cursor
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
2074 = XCreateFontCursor (FRAME_X_DISPLAY (f), XC_sb_h_double_arrow);
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
2075
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2076 /* Check and report errors with the above calls. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2077 x_check_errors (FRAME_W32_DISPLAY (f), "can't set cursor shape: %s");
17632
d2915156a803 (x_set_mouse_color): Update calls to x_catch_errors
Richard M. Stallman <rms@gnu.org>
parents: 16884
diff changeset
2078 x_uncatch_errors (FRAME_W32_DISPLAY (f), count);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2079
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2080 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2081 XColor fore_color, back_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2082
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2083 fore_color.pixel = f->output_data.w32->mouse_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2084 back_color.pixel = mask_color;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2085 XQueryColor (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2086 DefaultColormap (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2087 DefaultScreen (FRAME_W32_DISPLAY (f))),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2088 &fore_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2089 XQueryColor (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2090 DefaultColormap (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2091 DefaultScreen (FRAME_W32_DISPLAY (f))),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2092 &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2093 XRecolorCursor (FRAME_W32_DISPLAY (f), cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2094 &fore_color, &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2095 XRecolorCursor (FRAME_W32_DISPLAY (f), nontext_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2096 &fore_color, &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2097 XRecolorCursor (FRAME_W32_DISPLAY (f), mode_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2098 &fore_color, &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2099 XRecolorCursor (FRAME_W32_DISPLAY (f), cross_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2100 &fore_color, &back_color);
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
2101 XRecolorCursor (FRAME_W32_DISPLAY (f), hourglass_cursor,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2102 &fore_color, &back_color);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2103 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2104
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2105 if (FRAME_W32_WINDOW (f) != 0)
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2106 XDefineCursor (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), cursor);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2107
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2108 if (cursor != f->output_data.w32->text_cursor && f->output_data.w32->text_cursor != 0)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2109 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->text_cursor);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2110 f->output_data.w32->text_cursor = cursor;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2111
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2112 if (nontext_cursor != f->output_data.w32->nontext_cursor
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2113 && f->output_data.w32->nontext_cursor != 0)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2114 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->nontext_cursor);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2115 f->output_data.w32->nontext_cursor = nontext_cursor;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2116
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
2117 if (hourglass_cursor != f->output_data.w32->hourglass_cursor
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
2118 && f->output_data.w32->hourglass_cursor != 0)
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
2119 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->hourglass_cursor);
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
2120 f->output_data.w32->hourglass_cursor = hourglass_cursor;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2121
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2122 if (mode_cursor != f->output_data.w32->modeline_cursor
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2123 && f->output_data.w32->modeline_cursor != 0)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2124 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2125 f->output_data.w32->modeline_cursor = mode_cursor;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2126
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2127 if (cross_cursor != f->output_data.w32->cross_cursor
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2128 && f->output_data.w32->cross_cursor != 0)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2129 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2130 f->output_data.w32->cross_cursor = cross_cursor;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2131
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2132 XFlush (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2133 UNBLOCK_INPUT;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2134
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2135 update_face_from_frame_parameter (f, Qmouse_color, arg);
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
2136 #endif /* TODO */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2137 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2138
34062
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
2139 /* Defined in w32term.c. */
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
2140 void x_update_cursor (struct frame *f, int on_p);
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
2141
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2142 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2143 x_set_cursor_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2144 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2145 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2146 {
34062
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
2147 unsigned long fore_pixel, pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2148
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2149 if (!NILP (Vx_cursor_fore_pixel))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2150 fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel,
34062
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
2151 WHITE_PIX_DEFAULT (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2152 else
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2153 fore_pixel = FRAME_BACKGROUND_PIXEL (f);
34062
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
2154
34089
445e01c537a3 Fix last change.
Jason Rumney <jasonr@gnu.org>
parents: 34062
diff changeset
2155 pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2156
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2157 /* Make sure that the cursor color differs from the background color. */
34062
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
2158 if (pixel == FRAME_BACKGROUND_PIXEL (f))
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
2159 {
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
2160 pixel = f->output_data.w32->mouse_pixel;
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
2161 if (pixel == fore_pixel)
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2162 fore_pixel = FRAME_BACKGROUND_PIXEL (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2163 }
34062
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
2164
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2165 FRAME_FOREGROUND_PIXEL (f) = fore_pixel;
34062
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
2166 f->output_data.w32->cursor_pixel = pixel;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2167
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2168 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2169 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2170 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2171 {
34062
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
2172 x_update_cursor (f, 0);
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
2173 x_update_cursor (f, 1);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2174 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2175 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2176
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2177 update_face_from_frame_parameter (f, Qcursor_color, arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2178 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2179
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2180 /* Set the border-color of frame F to pixel value PIX.
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2181 Note that this does not fully take effect if done before
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2182 F has an window. */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2183 void
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2184 x_set_border_pixel (f, pix)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2185 struct frame *f;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2186 int pix;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2187 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2188 f->output_data.w32->border_pixel = pix;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2189
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2190 if (FRAME_W32_WINDOW (f) != 0 && f->output_data.w32->border_width > 0)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2191 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2192 if (FRAME_VISIBLE_P (f))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2193 redraw_frame (f);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2194 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2195 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
2196
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2197 /* Set the border-color of frame F to value described by ARG.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2198 ARG can be a string naming a color.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2199 The border-color is used for the border that is drawn by the server.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2200 Note that this does not fully take effect if done before
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2201 F has a window; it must be redone when the window is created. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2202
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2203 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2204 x_set_border_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2205 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2206 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2207 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2208 int pix;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2209
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2210 CHECK_STRING (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2211 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2212 x_set_border_pixel (f, pix);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2213 update_face_from_frame_parameter (f, Qborder_color, arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2214 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2215
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2216 /* Value is the internal representation of the specified cursor type
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2217 ARG. If type is BAR_CURSOR, return in *WIDTH the specified width
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2218 of the bar cursor. */
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2219
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2220 enum text_cursor_kinds
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2221 x_specified_cursor_type (arg, width)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2222 Lisp_Object arg;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2223 int *width;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2224 {
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2225 enum text_cursor_kinds type;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2226
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2227 if (EQ (arg, Qbar))
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2228 {
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2229 type = BAR_CURSOR;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2230 *width = 2;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2231 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2232 else if (CONSP (arg)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2233 && EQ (XCAR (arg), Qbar)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2234 && INTEGERP (XCDR (arg))
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2235 && XINT (XCDR (arg)) >= 0)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2236 {
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2237 type = BAR_CURSOR;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2238 *width = XINT (XCDR (arg));
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2239 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2240 else if (NILP (arg))
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2241 type = NO_CURSOR;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2242 else
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2243 /* Treat anything unknown as "box cursor".
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2244 It was bad to signal an error; people have trouble fixing
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2245 .Xdefaults with Emacs, when it has something bad in it. */
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2246 type = FILLED_BOX_CURSOR;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2247
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2248 return type;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2249 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2250
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2251 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2252 x_set_cursor_type (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2253 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2254 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2255 {
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2256 int width;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2257
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2258 FRAME_DESIRED_CURSOR (f) = x_specified_cursor_type (arg, &width);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2259 f->output_data.w32->cursor_width = width;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2260
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2261 /* Make sure the cursor gets redrawn. This is overkill, but how
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2262 often do people change cursor types? */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2263 update_mode_lines++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2264 }
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2265
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2266 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2267 x_set_icon_type (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2268 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2269 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2270 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2271 int result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2272
25235
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2273 if (NILP (arg) && NILP (oldval))
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2274 return;
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2275
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2276 if (STRINGP (arg) && STRINGP (oldval)
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2277 && EQ (Fstring_equal (oldval, arg), Qt))
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2278 return;
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2279
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2280 if (SYMBOLP (arg) && SYMBOLP (oldval) && EQ (arg, oldval))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2281 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2282
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2283 BLOCK_INPUT;
25235
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2284
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2285 result = x_bitmap_icon (f, arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2286 if (result)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2287 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2288 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2289 error ("No icon window available");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2290 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2291
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2292 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2293 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2294
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2295 /* Return non-nil if frame F wants a bitmap icon. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2296
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2297 Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2298 x_icon_type (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2299 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2300 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2301 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2302
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2303 tem = assq_no_quit (Qicon_type, f->param_alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2304 if (CONSP (tem))
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
2305 return XCDR (tem);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2306 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2307 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2308 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2309
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2310 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2311 x_set_icon_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2312 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2313 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2314 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2315 if (STRINGP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2316 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2317 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2318 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2319 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2320 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2321 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2322
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2323 f->icon_name = arg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2324
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2325 #if 0
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2326 if (f->output_data.w32->icon_bitmap != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2327 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2328
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2329 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2330
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2331 result = x_text_icon (f,
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2332 (char *) XSTRING ((!NILP (f->icon_name)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2333 ? f->icon_name
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2334 : !NILP (f->title)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2335 ? f->title
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2336 : f->name))->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2337
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2338 if (result)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2339 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2340 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2341 error ("No icon window available");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2342 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2343
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2344 /* If the window was unmapped (and its icon was mapped),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2345 the new icon is not mapped, so map the window in its stead. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2346 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2347 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2348 #ifdef USE_X_TOOLKIT
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2349 XtPopup (f->output_data.w32->widget, XtGrabNone);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2350 #endif
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2351 XMapWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2352 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2353
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2354 XFlush (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2355 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2356 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2357 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2358
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2359 extern Lisp_Object x_new_font ();
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2360 extern Lisp_Object x_new_fontset();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2361
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2362 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2363 x_set_font (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2364 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2365 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2366 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2367 Lisp_Object result;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2368 Lisp_Object fontset_name;
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
2369 Lisp_Object frame;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2370
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2371 CHECK_STRING (arg, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2372
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2373 fontset_name = Fquery_fontset (arg, Qnil);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2374
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2375 BLOCK_INPUT;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2376 result = (STRINGP (fontset_name)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2377 ? x_new_fontset (f, XSTRING (fontset_name)->data)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2378 : x_new_font (f, XSTRING (arg)->data));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2379 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2380
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2381 if (EQ (result, Qnil))
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2382 error ("Font `%s' is not defined", XSTRING (arg)->data);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2383 else if (EQ (result, Qt))
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2384 error ("The characters of the given font have varying widths");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2385 else if (STRINGP (result))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2386 {
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
2387 if (!NILP (Fequal (result, oldval)))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
2388 return;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2389 store_frame_param (f, Qfont, result);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2390 recompute_basic_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2391 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2392 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2393 abort ();
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
2394
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2395 do_pending_window_change (0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2396
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2397 /* Don't call `face-set-after-frame-default' when faces haven't been
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2398 initialized yet. This is the case when called from
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2399 Fx_create_frame. In that case, the X widget or window doesn't
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2400 exist either, and we can end up in x_report_frame_params with a
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2401 null widget which gives a segfault. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2402 if (FRAME_FACE_CACHE (f))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2403 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2404 XSETFRAME (frame, f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2405 call1 (Qface_set_after_frame_default, frame);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2406 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2407 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2408
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2409 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2410 x_set_border_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2411 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2412 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2413 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2414 CHECK_NUMBER (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2415
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2416 if (XINT (arg) == f->output_data.w32->border_width)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2417 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2418
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2419 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2420 error ("Cannot change the border width of a window");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2421
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2422 f->output_data.w32->border_width = XINT (arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2423 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2424
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2425 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2426 x_set_internal_border_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2427 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2428 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2429 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2430 int old = f->output_data.w32->internal_border_width;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2431
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2432 CHECK_NUMBER (arg, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2433 f->output_data.w32->internal_border_width = XINT (arg);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2434 if (f->output_data.w32->internal_border_width < 0)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2435 f->output_data.w32->internal_border_width = 0;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2436
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2437 if (f->output_data.w32->internal_border_width == old)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2438 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2439
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2440 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2441 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2442 x_set_window_size (f, 0, f->width, f->height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2443 SET_FRAME_GARBAGED (f);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2444 do_pending_window_change (0);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2445 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2446 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2447
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2448 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2449 x_set_visibility (f, value, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2450 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2451 Lisp_Object value, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2452 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2453 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2454 XSETFRAME (frame, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2455
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2456 if (NILP (value))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2457 Fmake_frame_invisible (frame, Qt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2458 else if (EQ (value, Qicon))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2459 Ficonify_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2460 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2461 Fmake_frame_visible (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2462 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2463
33870
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2464
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2465 /* Change window heights in windows rooted in WINDOW by N lines. */
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2466
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2467 static void
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2468 x_change_window_heights (window, n)
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2469 Lisp_Object window;
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2470 int n;
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2471 {
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2472 struct window *w = XWINDOW (window);
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2473
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2474 XSETFASTINT (w->top, XFASTINT (w->top) + n);
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2475 XSETFASTINT (w->height, XFASTINT (w->height) - n);
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2476
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2477 if (INTEGERP (w->orig_top))
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2478 XSETFASTINT (w->orig_top, XFASTINT (w->orig_top) + n);
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2479 if (INTEGERP (w->orig_height))
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2480 XSETFASTINT (w->orig_height, XFASTINT (w->orig_height) - n);
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2481
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2482 /* Handle just the top child in a vertical split. */
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2483 if (!NILP (w->vchild))
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2484 x_change_window_heights (w->vchild, n);
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2485
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2486 /* Adjust all children in a horizontal split. */
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2487 for (window = w->hchild; !NILP (window); window = w->next)
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2488 {
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2489 w = XWINDOW (window);
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2490 x_change_window_heights (window, n);
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2491 }
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2492 }
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
2493
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2494 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2495 x_set_menu_bar_lines (f, value, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2496 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2497 Lisp_Object value, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2498 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2499 int nlines;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2500 int olines = FRAME_MENU_BAR_LINES (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2501
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2502 /* Right now, menu bars don't work properly in minibuf-only frames;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2503 most of the commands try to apply themselves to the minibuffer
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2504 frame itself, and get an error because you can't switch buffers
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2505 in or split the minibuffer window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2506 if (FRAME_MINIBUF_ONLY_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2507 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2508
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2509 if (INTEGERP (value))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2510 nlines = XINT (value);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2511 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2512 nlines = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2513
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2514 FRAME_MENU_BAR_LINES (f) = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2515 if (nlines)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2516 FRAME_EXTERNAL_MENU_BAR (f) = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2517 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2518 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2519 if (FRAME_EXTERNAL_MENU_BAR (f) == 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2520 free_frame_menubar (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2521 FRAME_EXTERNAL_MENU_BAR (f) = 0;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2522
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2523 /* Adjust the frame size so that the client (text) dimensions
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2524 remain the same. This depends on FRAME_EXTERNAL_MENU_BAR being
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2525 set correctly. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2526 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2527 do_pending_window_change (0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2528 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2529 adjust_glyphs (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2530 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2531
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2532
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2533 /* Set the number of lines used for the tool bar of frame F to VALUE.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2534 VALUE not an integer, or < 0 means set the lines to zero. OLDVAL
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2535 is the old number of tool bar lines. This function changes the
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2536 height of all windows on frame F to match the new tool bar height.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2537 The frame's height doesn't change. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2538
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2539 void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2540 x_set_tool_bar_lines (f, value, oldval)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2541 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2542 Lisp_Object value, oldval;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2543 {
33865
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2544 int delta, nlines, root_height;
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2545 Lisp_Object root_window;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2546
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
2547 /* Treat tool bars like menu bars. */
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
2548 if (FRAME_MINIBUF_ONLY_P (f))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
2549 return;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
2550
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2551 /* Use VALUE only if an integer >= 0. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2552 if (INTEGERP (value) && XINT (value) >= 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2553 nlines = XFASTINT (value);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2554 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2555 nlines = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2556
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2557 /* Make sure we redisplay all windows in this frame. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2558 ++windows_or_buffers_changed;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2559
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2560 delta = nlines - FRAME_TOOL_BAR_LINES (f);
33865
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2561
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2562 /* Don't resize the tool-bar to more than we have room for. */
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2563 root_window = FRAME_ROOT_WINDOW (f);
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2564 root_height = XINT (XWINDOW (root_window)->height);
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2565 if (root_height - delta < 1)
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2566 {
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2567 delta = root_height - 1;
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2568 nlines = FRAME_TOOL_BAR_LINES (f) + delta;
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2569 }
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2570
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2571 FRAME_TOOL_BAR_LINES (f) = nlines;
33865
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2572 x_change_window_heights (root_window, delta);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2573 adjust_glyphs (f);
33865
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2574
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2575 /* We also have to make sure that the internal border at the top of
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2576 the frame, below the menu bar or tool bar, is redrawn when the
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2577 tool bar disappears. This is so because the internal border is
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2578 below the tool bar if one is displayed, but is below the menu bar
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2579 if there isn't a tool bar. The tool bar draws into the area
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2580 below the menu bar. */
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2581 if (FRAME_W32_WINDOW (f) && FRAME_TOOL_BAR_LINES (f) == 0)
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2582 {
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2583 updating_frame = f;
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2584 clear_frame ();
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2585 clear_current_matrices (f);
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2586 updating_frame = NULL;
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2587 }
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2588
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2589 /* If the tool bar gets smaller, the internal border below it
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2590 has to be cleared. It was formerly part of the display
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2591 of the larger tool bar, and updating windows won't clear it. */
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2592 if (delta < 0)
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2593 {
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2594 int height = FRAME_INTERNAL_BORDER_WIDTH (f);
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2595 int width = PIXEL_WIDTH (f);
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2596 int y = nlines * CANON_Y_UNIT (f);
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2597
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2598 BLOCK_INPUT;
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2599 {
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2600 HDC hdc = get_frame_dc (f);
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2601 w32_clear_area (f, hdc, 0, y, width, height);
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2602 release_frame_dc (f, hdc);
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2603 }
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2604 UNBLOCK_INPUT;
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
2605 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2606 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2607
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2608
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2609 /* Change the name of frame F to NAME. If NAME is nil, set F's name to
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2610 w32_id_name.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2611
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2612 If EXPLICIT is non-zero, that indicates that lisp code is setting the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2613 name; if NAME is a string, set F's name to NAME and set
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2614 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2615
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2616 If EXPLICIT is zero, that indicates that Emacs redisplay code is
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2617 suggesting a new name, which lisp code should override; if
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2618 F->explicit_name is set, ignore the new name; otherwise, set it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2619
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2620 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2621 x_set_name (f, name, explicit)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2622 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2623 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2624 int explicit;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2625 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2626 /* Make sure that requests from lisp code override requests from
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2627 Emacs redisplay code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2628 if (explicit)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2629 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2630 /* If we're switching from explicit to implicit, we had better
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2631 update the mode lines and thereby update the title. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2632 if (f->explicit_name && NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2633 update_mode_lines = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2634
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2635 f->explicit_name = ! NILP (name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2636 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2637 else if (f->explicit_name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2638 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2639
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2640 /* If NAME is nil, set the name to the w32_id_name. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2641 if (NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2642 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2643 /* Check for no change needed in this very common case
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2644 before we do any consing. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2645 if (!strcmp (FRAME_W32_DISPLAY_INFO (f)->w32_id_name,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2646 XSTRING (f->name)->data))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2647 return;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2648 name = build_string (FRAME_W32_DISPLAY_INFO (f)->w32_id_name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2649 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2650 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2651 CHECK_STRING (name, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2652
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2653 /* Don't change the name if it's already NAME. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2654 if (! NILP (Fstring_equal (name, f->name)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2655 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2656
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2657 f->name = name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2658
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2659 /* For setting the frame title, the title parameter should override
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2660 the name parameter. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2661 if (! NILP (f->title))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2662 name = f->title;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2663
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2664 if (FRAME_W32_WINDOW (f))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2665 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2666 if (STRING_MULTIBYTE (name))
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2667 name = ENCODE_SYSTEM (name);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2668
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2669 BLOCK_INPUT;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2670 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2671 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2672 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2673 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2674
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2675 /* This function should be called when the user's lisp code has
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2676 specified a name for the frame; the name will override any set by the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2677 redisplay code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2678 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2679 x_explicitly_set_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2680 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2681 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2682 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2683 x_set_name (f, arg, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2684 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2685
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2686 /* This function should be called by Emacs redisplay code to set the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2687 name; names set this way will never override names set by the user's
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2688 lisp code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2689 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2690 x_implicitly_set_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2691 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2692 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2693 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2694 x_set_name (f, arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2695 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2696
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2697 /* Change the title of frame F to NAME.
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2698 If NAME is nil, use the frame name as the title.
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2699
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2700 If EXPLICIT is non-zero, that indicates that lisp code is setting the
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2701 name; if NAME is a string, set F's name to NAME and set
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2702 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2703
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2704 If EXPLICIT is zero, that indicates that Emacs redisplay code is
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2705 suggesting a new name, which lisp code should override; if
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2706 F->explicit_name is set, ignore the new name; otherwise, set it. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2708 void
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2709 x_set_title (f, name, old_name)
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2710 struct frame *f;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2711 Lisp_Object name, old_name;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2712 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2713 /* Don't change the title if it's already NAME. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2714 if (EQ (name, f->title))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2715 return;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2716
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2717 update_mode_lines = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2718
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2719 f->title = name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2720
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2721 if (NILP (name))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2722 name = f->name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2723
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2724 if (FRAME_W32_WINDOW (f))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2725 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2726 if (STRING_MULTIBYTE (name))
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2727 name = ENCODE_SYSTEM (name);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2728
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2729 BLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2730 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2731 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2732 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2733 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2734
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2735 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2736 x_set_autoraise (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2737 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2738 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2739 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2740 f->auto_raise = !EQ (Qnil, arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2741 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2742
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2743 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2744 x_set_autolower (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2745 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2746 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2747 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2748 f->auto_lower = !EQ (Qnil, arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2749 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2750
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2751 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2752 x_set_unsplittable (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2753 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2754 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2755 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2756 f->no_split = !NILP (arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2757 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2758
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2759 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2760 x_set_vertical_scroll_bars (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2761 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2762 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2763 {
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2764 if ((EQ (arg, Qleft) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2765 || (EQ (arg, Qright) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f))
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2766 || (NILP (arg) && FRAME_HAS_VERTICAL_SCROLL_BARS (f))
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2767 || (!NILP (arg) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f)))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2768 {
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2769 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = NILP (arg) ?
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2770 vertical_scroll_bar_none :
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
2771 /* Put scroll bars on the right by default, as is conventional
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
2772 on MS-Windows. */
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
2773 EQ (Qleft, arg)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
2774 ? vertical_scroll_bar_left
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
2775 : vertical_scroll_bar_right;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2776
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2777 /* We set this parameter before creating the window for the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2778 frame, so we can get the geometry right from the start.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2779 However, if the window hasn't been created yet, we shouldn't
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2780 call x_set_window_size. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2781 if (FRAME_W32_WINDOW (f))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2782 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2783 do_pending_window_change (0);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2784 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2785 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2786
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2787 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2788 x_set_scroll_bar_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2789 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2790 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2791 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2792 int wid = FONT_WIDTH (f->output_data.w32->font);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2793
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2794 if (NILP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2795 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2796 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2797 FRAME_SCROLL_BAR_COLS (f) = (FRAME_SCROLL_BAR_PIXEL_WIDTH (f) +
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2798 wid - 1) / wid;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2799 if (FRAME_W32_WINDOW (f))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2800 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2801 do_pending_window_change (0);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2802 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2803 else if (INTEGERP (arg) && XINT (arg) > 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2804 && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2805 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2806 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2807 FRAME_SCROLL_BAR_COLS (f) = (FRAME_SCROLL_BAR_PIXEL_WIDTH (f)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2808 + wid-1) / wid;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2809 if (FRAME_W32_WINDOW (f))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2810 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2811 do_pending_window_change (0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2812 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2813 change_frame_size (f, 0, FRAME_WIDTH (f), 0, 0, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2814 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2815 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2816 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2817
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2818 /* Subroutines of creating an frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2819
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2820 /* Make sure that Vx_resource_name is set to a reasonable value.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2821 Fix it up, or set it to `emacs' if it is too hopeless. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2822
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2823 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2824 validate_x_resource_name ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2825 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2826 int len = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2827 /* Number of valid characters in the resource name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2828 int good_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2829 /* Number of invalid characters in the resource name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2830 int bad_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2831 Lisp_Object new;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2832 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2833
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2834 if (STRINGP (Vx_resource_name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2835 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2836 unsigned char *p = XSTRING (Vx_resource_name)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2837 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2838
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2839 len = STRING_BYTES (XSTRING (Vx_resource_name));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2840
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2841 /* Only letters, digits, - and _ are valid in resource names.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2842 Count the valid characters and count the invalid ones. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2843 for (i = 0; i < len; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2844 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2845 int c = p[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2846 if (! ((c >= 'a' && c <= 'z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2847 || (c >= 'A' && c <= 'Z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2848 || (c >= '0' && c <= '9')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2849 || c == '-' || c == '_'))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2850 bad_count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2851 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2852 good_count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2853 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2854 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2855 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2856 /* Not a string => completely invalid. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2857 bad_count = 5, good_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2858
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2859 /* If name is valid already, return. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2860 if (bad_count == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2861 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2862
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2863 /* If name is entirely invalid, or nearly so, use `emacs'. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2864 if (good_count == 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2865 || (good_count == 1 && bad_count > 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2866 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2867 Vx_resource_name = build_string ("emacs");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2868 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2869 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2870
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2871 /* Name is partly valid. Copy it and replace the invalid characters
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2872 with underscores. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2873
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2874 Vx_resource_name = new = Fcopy_sequence (Vx_resource_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2875
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2876 for (i = 0; i < len; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2877 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2878 int c = XSTRING (new)->data[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2879 if (! ((c >= 'a' && c <= 'z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2880 || (c >= 'A' && c <= 'Z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2881 || (c >= '0' && c <= '9')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2882 || c == '-' || c == '_'))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2883 XSTRING (new)->data[i] = '_';
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2884 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2885 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2886
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2887
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2888 extern char *x_get_string_resource ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2889
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2890 DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 2, 4, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2891 "Return the value of ATTRIBUTE, of class CLASS, from the X defaults database.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2892 This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2893 class, where INSTANCE is the name under which Emacs was invoked, or\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2894 the name specified by the `-name' or `-rn' command-line arguments.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2895 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2896 The optional arguments COMPONENT and SUBCLASS add to the key and the\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2897 class, respectively. You must specify both of them or neither.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2898 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2899 and the class is `Emacs.CLASS.SUBCLASS'.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2900 (attribute, class, component, subclass)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2901 Lisp_Object attribute, class, component, subclass;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2902 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2903 register char *value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2904 char *name_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2905 char *class_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2906
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2907 CHECK_STRING (attribute, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2908 CHECK_STRING (class, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2909
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2910 if (!NILP (component))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2911 CHECK_STRING (component, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2912 if (!NILP (subclass))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2913 CHECK_STRING (subclass, 2);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2914 if (NILP (component) != NILP (subclass))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2915 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2916
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2917 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2918
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2919 /* Allocate space for the components, the dots which separate them,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2920 and the final '\0'. Make them big enough for the worst case. */
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2921 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2922 + (STRINGP (component)
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2923 ? STRING_BYTES (XSTRING (component)) : 0)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2924 + STRING_BYTES (XSTRING (attribute))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2925 + 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2926
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2927 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2928 + STRING_BYTES (XSTRING (class))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2929 + (STRINGP (subclass)
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2930 ? STRING_BYTES (XSTRING (subclass)) : 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2931 + 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2932
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2933 /* Start with emacs.FRAMENAME for the name (the specific one)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2934 and with `Emacs' for the class key (the general one). */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2935 strcpy (name_key, XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2936 strcpy (class_key, EMACS_CLASS);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2937
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2938 strcat (class_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2939 strcat (class_key, XSTRING (class)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2940
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2941 if (!NILP (component))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2942 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2943 strcat (class_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2944 strcat (class_key, XSTRING (subclass)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2945
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2946 strcat (name_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2947 strcat (name_key, XSTRING (component)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2948 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2949
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2950 strcat (name_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2951 strcat (name_key, XSTRING (attribute)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2952
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2953 value = x_get_string_resource (Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2954 name_key, class_key);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2955
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2956 if (value != (char *) 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2957 return build_string (value);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2958 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2959 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2960 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2961
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2962 /* Used when C code wants a resource value. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2963
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2964 char *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2965 x_get_resource_string (attribute, class)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2966 char *attribute, *class;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2967 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2968 char *name_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2969 char *class_key;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2970 struct frame *sf = SELECTED_FRAME ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2971
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2972 /* Allocate space for the components, the dots which separate them,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2973 and the final '\0'. */
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
2974 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vinvocation_name))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2975 + strlen (attribute) + 2);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2976 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2977 + strlen (class) + 2);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2978
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2979 sprintf (name_key, "%s.%s",
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2980 XSTRING (Vinvocation_name)->data,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2981 attribute);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2982 sprintf (class_key, "%s.%s", EMACS_CLASS, class);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2983
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2984 return x_get_string_resource (sf, name_key, class_key);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2985 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2986
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2987 /* Types we might convert a resource string into. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2988 enum resource_types
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2989 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2990 RES_TYPE_NUMBER,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2991 RES_TYPE_FLOAT,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2992 RES_TYPE_BOOLEAN,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2993 RES_TYPE_STRING,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2994 RES_TYPE_SYMBOL
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2995 };
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2996
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2997 /* Return the value of parameter PARAM.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2998
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2999 First search ALIST, then Vdefault_frame_alist, then the X defaults
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3000 database, using ATTRIBUTE as the attribute name and CLASS as its class.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3001
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3002 Convert the resource to the type specified by desired_type.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3003
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3004 If no default is specified, return Qunbound. If you call
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3005 w32_get_arg, make sure you deal with Qunbound in a reasonable way,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3006 and don't let it get stored in any Lisp-visible variables! */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3007
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3008 static Lisp_Object
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3009 w32_get_arg (alist, param, attribute, class, type)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3010 Lisp_Object alist, param;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3011 char *attribute;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3012 char *class;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3013 enum resource_types type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3014 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3015 register Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3016
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3017 tem = Fassq (param, alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3018 if (EQ (tem, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3019 tem = Fassq (param, Vdefault_frame_alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3020 if (EQ (tem, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3021 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3022
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3023 if (attribute)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3024 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3025 tem = Fx_get_resource (build_string (attribute),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3026 build_string (class),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3027 Qnil, Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3028
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3029 if (NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3030 return Qunbound;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3031
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3032 switch (type)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3033 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3034 case RES_TYPE_NUMBER:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3035 return make_number (atoi (XSTRING (tem)->data));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3036
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3037 case RES_TYPE_FLOAT:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3038 return make_float (atof (XSTRING (tem)->data));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3039
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3040 case RES_TYPE_BOOLEAN:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3041 tem = Fdowncase (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3042 if (!strcmp (XSTRING (tem)->data, "on")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3043 || !strcmp (XSTRING (tem)->data, "true"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3044 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3045 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3046 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3047
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3048 case RES_TYPE_STRING:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3049 return tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3050
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3051 case RES_TYPE_SYMBOL:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3052 /* As a special case, we map the values `true' and `on'
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3053 to Qt, and `false' and `off' to Qnil. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3054 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3055 Lisp_Object lower;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3056 lower = Fdowncase (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3057 if (!strcmp (XSTRING (lower)->data, "on")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3058 || !strcmp (XSTRING (lower)->data, "true"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3059 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3060 else if (!strcmp (XSTRING (lower)->data, "off")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3061 || !strcmp (XSTRING (lower)->data, "false"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3062 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3063 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3064 return Fintern (tem, Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3065 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3066
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3067 default:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3068 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3069 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3070 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3071 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3072 return Qunbound;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3073 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3074 return Fcdr (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3075 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3076
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3077 /* Record in frame F the specified or default value according to ALIST
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
3078 of the parameter named PROP (a Lisp symbol).
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
3079 If no value is specified for PROP, look for an X default for XPROP
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3080 on the frame named NAME.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3081 If that is not found either, use the value DEFLT. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3082
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3083 static Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3084 x_default_parameter (f, alist, prop, deflt, xprop, xclass, type)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3085 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3086 Lisp_Object alist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3087 Lisp_Object prop;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3088 Lisp_Object deflt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3089 char *xprop;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3090 char *xclass;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3091 enum resource_types type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3092 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3093 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3094
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3095 tem = w32_get_arg (alist, prop, xprop, xclass, type);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3096 if (EQ (tem, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3097 tem = deflt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3098 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3099 return tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3100 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3101
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3102 DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3103 "Parse an X-style geometry string STRING.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3104 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3105 The properties returned may include `top', `left', `height', and `width'.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3106 The value of `left' or `top' may be an integer,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3107 or a list (+ N) meaning N pixels relative to top/left corner,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3108 or a list (- N) meaning -N pixels relative to bottom/right corner.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3109 (string)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3110 Lisp_Object string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3111 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3112 int geometry, x, y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3113 unsigned int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3114 Lisp_Object result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3115
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3116 CHECK_STRING (string, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3117
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3118 geometry = XParseGeometry ((char *) XSTRING (string)->data,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3119 &x, &y, &width, &height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3120
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3121 result = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3122 if (geometry & XValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3123 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3124 Lisp_Object element;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3125
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3126 if (x >= 0 && (geometry & XNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3127 element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3128 else if (x < 0 && ! (geometry & XNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3129 element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3130 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3131 element = Fcons (Qleft, make_number (x));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3132 result = Fcons (element, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3133 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3134
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3135 if (geometry & YValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3136 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3137 Lisp_Object element;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3138
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3139 if (y >= 0 && (geometry & YNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3140 element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3141 else if (y < 0 && ! (geometry & YNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3142 element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3143 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3144 element = Fcons (Qtop, make_number (y));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3145 result = Fcons (element, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3146 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3147
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3148 if (geometry & WidthValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3149 result = Fcons (Fcons (Qwidth, make_number (width)), result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3150 if (geometry & HeightValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3151 result = Fcons (Fcons (Qheight, make_number (height)), result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3152
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3153 return result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3154 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3155
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3156 /* Calculate the desired size and position of this window,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3157 and return the flags saying which aspects were specified.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3158
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3159 This function does not make the coordinates positive. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3160
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3161 #define DEFAULT_ROWS 40
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3162 #define DEFAULT_COLS 80
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3163
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3164 static int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3165 x_figure_window_size (f, parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3166 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3167 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3168 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3169 register Lisp_Object tem0, tem1, tem2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3170 long window_prompting = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3171
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3172 /* Default values if we fall through.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3173 Actually, if that happens we should get
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3174 window manager prompting. */
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
3175 SET_FRAME_WIDTH (f, DEFAULT_COLS);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3176 f->height = DEFAULT_ROWS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3177 /* Window managers expect that if program-specified
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3178 positions are not (0,0), they're intentional, not defaults. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3179 f->output_data.w32->top_pos = 0;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3180 f->output_data.w32->left_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3181
34942
af688bd6c419 (x_figure_window_size): Do not allow new_height and
Jason Rumney <jasonr@gnu.org>
parents: 34729
diff changeset
3182 /* Ensure that old new_width and new_height will not override the
af688bd6c419 (x_figure_window_size): Do not allow new_height and
Jason Rumney <jasonr@gnu.org>
parents: 34729
diff changeset
3183 values set here. */
af688bd6c419 (x_figure_window_size): Do not allow new_height and
Jason Rumney <jasonr@gnu.org>
parents: 34729
diff changeset
3184 FRAME_NEW_WIDTH (f) = 0;
af688bd6c419 (x_figure_window_size): Do not allow new_height and
Jason Rumney <jasonr@gnu.org>
parents: 34729
diff changeset
3185 FRAME_NEW_HEIGHT (f) = 0;
af688bd6c419 (x_figure_window_size): Do not allow new_height and
Jason Rumney <jasonr@gnu.org>
parents: 34729
diff changeset
3186
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3187 tem0 = w32_get_arg (parms, Qheight, 0, 0, RES_TYPE_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3188 tem1 = w32_get_arg (parms, Qwidth, 0, 0, RES_TYPE_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3189 tem2 = w32_get_arg (parms, Quser_size, 0, 0, RES_TYPE_NUMBER);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3190 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3191 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3192 if (!EQ (tem0, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3193 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3194 CHECK_NUMBER (tem0, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3195 f->height = XINT (tem0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3196 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3197 if (!EQ (tem1, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3198 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3199 CHECK_NUMBER (tem1, 0);
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
3200 SET_FRAME_WIDTH (f, XINT (tem1));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3201 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3202 if (!NILP (tem2) && !EQ (tem2, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3203 window_prompting |= USSize;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3204 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3205 window_prompting |= PSize;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3206 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3207
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3208 f->output_data.w32->vertical_scroll_bar_extra
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3209 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3210 ? 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3211 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3212 ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3213 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font)));
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3214 f->output_data.w32->flags_areas_extra
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3215 = FRAME_FLAGS_AREA_WIDTH (f);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3216 f->output_data.w32->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3217 f->output_data.w32->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3218
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3219 tem0 = w32_get_arg (parms, Qtop, 0, 0, RES_TYPE_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3220 tem1 = w32_get_arg (parms, Qleft, 0, 0, RES_TYPE_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3221 tem2 = w32_get_arg (parms, Quser_position, 0, 0, RES_TYPE_NUMBER);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3222 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3223 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3224 if (EQ (tem0, Qminus))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3225 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3226 f->output_data.w32->top_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3227 window_prompting |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3228 }
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3229 else if (CONSP (tem0) && EQ (XCAR (tem0), Qminus)
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3230 && CONSP (XCDR (tem0))
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3231 && INTEGERP (XCAR (XCDR (tem0))))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3232 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3233 f->output_data.w32->top_pos = - XINT (XCAR (XCDR (tem0)));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3234 window_prompting |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3235 }
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3236 else if (CONSP (tem0) && EQ (XCAR (tem0), Qplus)
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3237 && CONSP (XCDR (tem0))
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3238 && INTEGERP (XCAR (XCDR (tem0))))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3239 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3240 f->output_data.w32->top_pos = XINT (XCAR (XCDR (tem0)));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3241 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3242 else if (EQ (tem0, Qunbound))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3243 f->output_data.w32->top_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3244 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3245 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3246 CHECK_NUMBER (tem0, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3247 f->output_data.w32->top_pos = XINT (tem0);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3248 if (f->output_data.w32->top_pos < 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3249 window_prompting |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3250 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3251
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3252 if (EQ (tem1, Qminus))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3253 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3254 f->output_data.w32->left_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3255 window_prompting |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3256 }
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3257 else if (CONSP (tem1) && EQ (XCAR (tem1), Qminus)
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3258 && CONSP (XCDR (tem1))
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3259 && INTEGERP (XCAR (XCDR (tem1))))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3260 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3261 f->output_data.w32->left_pos = - XINT (XCAR (XCDR (tem1)));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3262 window_prompting |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3263 }
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3264 else if (CONSP (tem1) && EQ (XCAR (tem1), Qplus)
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3265 && CONSP (XCDR (tem1))
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3266 && INTEGERP (XCAR (XCDR (tem1))))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3267 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
3268 f->output_data.w32->left_pos = XINT (XCAR (XCDR (tem1)));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3269 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3270 else if (EQ (tem1, Qunbound))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3271 f->output_data.w32->left_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3272 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3273 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3274 CHECK_NUMBER (tem1, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3275 f->output_data.w32->left_pos = XINT (tem1);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3276 if (f->output_data.w32->left_pos < 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3277 window_prompting |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3278 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3279
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3280 if (!NILP (tem2) && ! EQ (tem2, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3281 window_prompting |= USPosition;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3282 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3283 window_prompting |= PPosition;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3284 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3285
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3286 return window_prompting;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3287 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3288
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3289
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3290
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3291 extern LRESULT CALLBACK w32_wnd_proc ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3292
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3293 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3294 w32_init_class (hinst)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3295 HINSTANCE hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3296 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3297 WNDCLASS wc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3298
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3299 wc.style = CS_HREDRAW | CS_VREDRAW;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3300 wc.lpfnWndProc = (WNDPROC) w32_wnd_proc;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3301 wc.cbClsExtra = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3302 wc.cbWndExtra = WND_EXTRA_BYTES;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3303 wc.hInstance = hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3304 wc.hIcon = LoadIcon (hinst, EMACS_CLASS);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3305 wc.hCursor = LoadCursor (NULL, IDC_ARROW);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
3306 wc.hbrBackground = NULL; /* GetStockObject (WHITE_BRUSH); */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3307 wc.lpszMenuName = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3308 wc.lpszClassName = EMACS_CLASS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3309
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3310 return (RegisterClass (&wc));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3311 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3312
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3313 HWND
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3314 w32_createscrollbar (f, bar)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3315 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3316 struct scroll_bar * bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3317 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3318 return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3319 /* Position and size of scroll bar. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3320 XINT(bar->left) + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3321 XINT(bar->top),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3322 XINT(bar->width) - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3323 XINT(bar->height),
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3324 FRAME_W32_WINDOW (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3325 NULL,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3326 hinst,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3327 NULL));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3328 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3329
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3330 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3331 w32_createwindow (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3332 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3333 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3334 HWND hwnd;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3335 RECT rect;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3336
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3337 rect.left = rect.top = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3338 rect.right = PIXEL_WIDTH (f);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3339 rect.bottom = PIXEL_HEIGHT (f);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3340
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3341 AdjustWindowRect (&rect, f->output_data.w32->dwStyle,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3342 FRAME_EXTERNAL_MENU_BAR (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3343
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3344 /* Do first time app init */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3345
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3346 if (!hprevinst)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3347 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3348 w32_init_class (hinst);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3349 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3350
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3351 FRAME_W32_WINDOW (f) = hwnd
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3352 = CreateWindow (EMACS_CLASS,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3353 f->namebuf,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3354 f->output_data.w32->dwStyle | WS_CLIPCHILDREN,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3355 f->output_data.w32->left_pos,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3356 f->output_data.w32->top_pos,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3357 rect.right - rect.left,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3358 rect.bottom - rect.top,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3359 NULL,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3360 NULL,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3361 hinst,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3362 NULL);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3363
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3364 if (hwnd)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3365 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3366 SetWindowLong (hwnd, WND_FONTWIDTH_INDEX, FONT_WIDTH (f->output_data.w32->font));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3367 SetWindowLong (hwnd, WND_LINEHEIGHT_INDEX, f->output_data.w32->line_height);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3368 SetWindowLong (hwnd, WND_BORDER_INDEX, f->output_data.w32->internal_border_width);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3369 SetWindowLong (hwnd, WND_SCROLLBAR_INDEX, f->output_data.w32->vertical_scroll_bar_extra);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
3370 SetWindowLong (hwnd, WND_BACKGROUND_INDEX, FRAME_BACKGROUND_PIXEL (f));
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3371
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3372 /* Enable drag-n-drop. */
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3373 DragAcceptFiles (hwnd, TRUE);
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3374
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3375 /* Do this to discard the default setting specified by our parent. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3376 ShowWindow (hwnd, SW_HIDE);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3377 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3378 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3379
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3380 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3381 my_post_msg (wmsg, hwnd, msg, wParam, lParam)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3382 W32Msg * wmsg;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3383 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3384 UINT msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3385 WPARAM wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3386 LPARAM lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3387 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3388 wmsg->msg.hwnd = hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3389 wmsg->msg.message = msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3390 wmsg->msg.wParam = wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3391 wmsg->msg.lParam = lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3392 wmsg->msg.time = GetMessageTime ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3393
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3394 post_msg (wmsg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3395 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3396
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
3397 /* GetKeyState and MapVirtualKey on Windows 95 do not actually distinguish
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3398 between left and right keys as advertised. We test for this
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3399 support dynamically, and set a flag when the support is absent. If
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3400 absent, we keep track of the left and right control and alt keys
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3401 ourselves. This is particularly necessary on keyboards that rely
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3402 upon the AltGr key, which is represented as having the left control
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3403 and right alt keys pressed. For these keyboards, we need to know
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3404 when the left alt key has been pressed in addition to the AltGr key
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3405 so that we can properly support M-AltGr-key sequences (such as M-@
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3406 on Swedish keyboards). */
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3407
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3408 #define EMACS_LCONTROL 0
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3409 #define EMACS_RCONTROL 1
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3410 #define EMACS_LMENU 2
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3411 #define EMACS_RMENU 3
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3412
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3413 static int modifiers[4];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3414 static int modifiers_recorded;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3415 static int modifier_key_support_tested;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3416
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3417 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3418 test_modifier_support (unsigned int wparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3419 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3420 unsigned int l, r;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3421
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3422 if (wparam != VK_CONTROL && wparam != VK_MENU)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3423 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3424 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3425 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3426 l = VK_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3427 r = VK_RCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3428 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3429 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3430 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3431 l = VK_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3432 r = VK_RMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3433 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3434 if (!(GetKeyState (l) & 0x8000) && !(GetKeyState (r) & 0x8000))
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3435 modifiers_recorded = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3436 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3437 modifiers_recorded = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3438 modifier_key_support_tested = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3439 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3440
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3441 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3442 record_keydown (unsigned int wparam, unsigned int lparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3443 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3444 int i;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3445
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3446 if (!modifier_key_support_tested)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3447 test_modifier_support (wparam);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3448
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3449 if ((wparam != VK_CONTROL && wparam != VK_MENU) || !modifiers_recorded)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3450 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3451
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3452 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3453 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3454 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3455 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3456
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3457 modifiers[i] = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3458 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3459
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3460 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3461 record_keyup (unsigned int wparam, unsigned int lparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3462 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3463 int i;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3464
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3465 if ((wparam != VK_CONTROL && wparam != VK_MENU) || !modifiers_recorded)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3466 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3467
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3468 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3469 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3470 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3471 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3472
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3473 modifiers[i] = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3474 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3475
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3476 /* Emacs can lose focus while a modifier key has been pressed. When
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3477 it regains focus, be conservative and clear all modifiers since
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3478 we cannot reconstruct the left and right modifier state. */
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3479 static void
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3480 reset_modifiers ()
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3481 {
15314
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3482 SHORT ctrl, alt;
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3483
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3484 if (GetFocus () == NULL)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3485 /* Emacs doesn't have keyboard focus. Do nothing. */
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3486 return;
15314
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3487
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3488 ctrl = GetAsyncKeyState (VK_CONTROL);
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3489 alt = GetAsyncKeyState (VK_MENU);
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3490
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3491 if (!(ctrl & 0x08000))
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3492 /* Clear any recorded control modifier state. */
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3493 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0;
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3494
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3495 if (!(alt & 0x08000))
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3496 /* Clear any recorded alt modifier state. */
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3497 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0;
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3498
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3499 /* Update the state of all modifier keys, because modifiers used in
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3500 hot-key combinations can get stuck on if Emacs loses focus as a
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3501 result of a hot-key being pressed. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3502 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3503 BYTE keystate[256];
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3504
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3505 #define CURRENT_STATE(key) ((GetAsyncKeyState (key) & 0x8000) >> 8)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3506
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3507 GetKeyboardState (keystate);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3508 keystate[VK_SHIFT] = CURRENT_STATE (VK_SHIFT);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3509 keystate[VK_CONTROL] = CURRENT_STATE (VK_CONTROL);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3510 keystate[VK_LCONTROL] = CURRENT_STATE (VK_LCONTROL);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3511 keystate[VK_RCONTROL] = CURRENT_STATE (VK_RCONTROL);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3512 keystate[VK_MENU] = CURRENT_STATE (VK_MENU);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3513 keystate[VK_LMENU] = CURRENT_STATE (VK_LMENU);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3514 keystate[VK_RMENU] = CURRENT_STATE (VK_RMENU);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3515 keystate[VK_LWIN] = CURRENT_STATE (VK_LWIN);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3516 keystate[VK_RWIN] = CURRENT_STATE (VK_RWIN);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3517 keystate[VK_APPS] = CURRENT_STATE (VK_APPS);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3518 SetKeyboardState (keystate);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3519 }
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3520 }
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3521
15377
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3522 /* Synchronize modifier state with what is reported with the current
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3523 keystroke. Even if we cannot distinguish between left and right
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3524 modifier keys, we know that, if no modifiers are set, then neither
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3525 the left or right modifier should be set. */
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3526 static void
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3527 sync_modifiers ()
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3528 {
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3529 if (!modifiers_recorded)
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3530 return;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3531
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3532 if (!(GetKeyState (VK_CONTROL) & 0x8000))
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3533 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3534
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3535 if (!(GetKeyState (VK_MENU) & 0x8000))
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3536 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3537 }
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3538
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3539 static int
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3540 modifier_set (int vkey)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3541 {
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3542 if (vkey == VK_CAPITAL || vkey == VK_SCROLL)
15280
f39684fddaff (modifier_set): Check toggle state of CapsLock even
Karl Heuer <kwzh@gnu.org>
parents: 15232
diff changeset
3543 return (GetKeyState (vkey) & 0x1);
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3544 if (!modifiers_recorded)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3545 return (GetKeyState (vkey) & 0x8000);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3546
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3547 switch (vkey)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3548 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3549 case VK_LCONTROL:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3550 return modifiers[EMACS_LCONTROL];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3551 case VK_RCONTROL:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3552 return modifiers[EMACS_RCONTROL];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3553 case VK_LMENU:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3554 return modifiers[EMACS_LMENU];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3555 case VK_RMENU:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3556 return modifiers[EMACS_RMENU];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3557 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3558 return (GetKeyState (vkey) & 0x8000);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3559 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3560
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3561 /* Convert between the modifier bits W32 uses and the modifier bits
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3562 Emacs uses. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3563
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3564 unsigned int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3565 w32_key_to_modifier (int key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3566 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3567 Lisp_Object key_mapping;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3568
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3569 switch (key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3570 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3571 case VK_LWIN:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3572 key_mapping = Vw32_lwindow_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3573 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3574 case VK_RWIN:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3575 key_mapping = Vw32_rwindow_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3576 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3577 case VK_APPS:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3578 key_mapping = Vw32_apps_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3579 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3580 case VK_SCROLL:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3581 key_mapping = Vw32_scroll_lock_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3582 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3583 default:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3584 key_mapping = Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3585 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3586
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3587 /* NB. This code runs in the input thread, asychronously to the lisp
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3588 thread, so we must be careful to ensure access to lisp data is
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3589 thread-safe. The following code is safe because the modifier
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3590 variable values are updated atomically from lisp and symbols are
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3591 not relocated by GC. Also, we don't have to worry about seeing GC
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3592 markbits here. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3593 if (EQ (key_mapping, Qhyper))
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3594 return hyper_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3595 if (EQ (key_mapping, Qsuper))
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3596 return super_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3597 if (EQ (key_mapping, Qmeta))
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3598 return meta_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3599 if (EQ (key_mapping, Qalt))
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3600 return alt_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3601 if (EQ (key_mapping, Qctrl))
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3602 return ctrl_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3603 if (EQ (key_mapping, Qcontrol)) /* synonym for ctrl */
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3604 return ctrl_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3605 if (EQ (key_mapping, Qshift))
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3606 return shift_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3607
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3608 /* Don't generate any modifier if not explicitly requested. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3609 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3610 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3611
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3612 unsigned int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3613 w32_get_modifiers ()
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3614 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3615 return ((modifier_set (VK_SHIFT) ? shift_modifier : 0) |
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3616 (modifier_set (VK_CONTROL) ? ctrl_modifier : 0) |
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3617 (modifier_set (VK_LWIN) ? w32_key_to_modifier (VK_LWIN) : 0) |
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3618 (modifier_set (VK_RWIN) ? w32_key_to_modifier (VK_RWIN) : 0) |
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3619 (modifier_set (VK_APPS) ? w32_key_to_modifier (VK_APPS) : 0) |
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3620 (modifier_set (VK_SCROLL) ? w32_key_to_modifier (VK_SCROLL) : 0) |
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3621 (modifier_set (VK_MENU) ?
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3622 ((NILP (Vw32_alt_is_meta)) ? alt_modifier : meta_modifier) : 0));
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3623 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3624
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3625 /* We map the VK_* modifiers into console modifier constants
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3626 so that we can use the same routines to handle both console
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3627 and window input. */
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3628
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3629 static int
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3630 construct_console_modifiers ()
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3631 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3632 int mods;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3633
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3634 mods = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3635 mods |= (modifier_set (VK_SHIFT)) ? SHIFT_PRESSED : 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3636 mods |= (modifier_set (VK_CAPITAL)) ? CAPSLOCK_ON : 0;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3637 mods |= (modifier_set (VK_SCROLL)) ? SCROLLLOCK_ON : 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3638 mods |= (modifier_set (VK_NUMLOCK)) ? NUMLOCK_ON : 0;
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3639 mods |= (modifier_set (VK_LCONTROL)) ? LEFT_CTRL_PRESSED : 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3640 mods |= (modifier_set (VK_RCONTROL)) ? RIGHT_CTRL_PRESSED : 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3641 mods |= (modifier_set (VK_LMENU)) ? LEFT_ALT_PRESSED : 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3642 mods |= (modifier_set (VK_RMENU)) ? RIGHT_ALT_PRESSED : 0;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3643 mods |= (modifier_set (VK_LWIN)) ? LEFT_WIN_PRESSED : 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3644 mods |= (modifier_set (VK_RWIN)) ? RIGHT_WIN_PRESSED : 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3645 mods |= (modifier_set (VK_APPS)) ? APPS_PRESSED : 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3646
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3647 return mods;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3648 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3649
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3650 static int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3651 w32_get_key_modifiers (unsigned int wparam, unsigned int lparam)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3652 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3653 int mods;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3654
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3655 /* Convert to emacs modifiers. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3656 mods = w32_kbd_mods_to_emacs (construct_console_modifiers (), wparam);
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3657
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3658 return mods;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3659 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3660
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3661 unsigned int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3662 map_keypad_keys (unsigned int virt_key, unsigned int extended)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3663 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3664 if (virt_key < VK_CLEAR || virt_key > VK_DELETE)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3665 return virt_key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3666
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3667 if (virt_key == VK_RETURN)
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3668 return (extended ? VK_NUMPAD_ENTER : VK_RETURN);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3669
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3670 if (virt_key >= VK_PRIOR && virt_key <= VK_DOWN)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3671 return (!extended ? (VK_NUMPAD_PRIOR + (virt_key - VK_PRIOR)) : virt_key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3672
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3673 if (virt_key == VK_INSERT || virt_key == VK_DELETE)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3674 return (!extended ? (VK_NUMPAD_INSERT + (virt_key - VK_INSERT)) : virt_key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3675
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3676 if (virt_key == VK_CLEAR)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3677 return (!extended ? VK_NUMPAD_CLEAR : virt_key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3678
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3679 return virt_key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3680 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3682 /* List of special key combinations which w32 would normally capture,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3683 but emacs should grab instead. Not directly visible to lisp, to
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3684 simplify synchronization. Each item is an integer encoding a virtual
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3685 key code and modifier combination to capture. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3686 Lisp_Object w32_grabbed_keys;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3687
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3688 #define HOTKEY(vk,mods) make_number (((vk) & 255) | ((mods) << 8))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3689 #define HOTKEY_ID(k) (XFASTINT (k) & 0xbfff)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3690 #define HOTKEY_VK_CODE(k) (XFASTINT (k) & 255)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3691 #define HOTKEY_MODIFIERS(k) (XFASTINT (k) >> 8)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3692
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3693 /* Register hot-keys for reserved key combinations when Emacs has
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3694 keyboard focus, since this is the only way Emacs can receive key
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3695 combinations like Alt-Tab which are used by the system. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3696
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3697 static void
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3698 register_hot_keys (hwnd)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3699 HWND hwnd;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3700 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3701 Lisp_Object keylist;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3702
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3703 /* Use GC_CONSP, since we are called asynchronously. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3704 for (keylist = w32_grabbed_keys; GC_CONSP (keylist); keylist = XCDR (keylist))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3705 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3706 Lisp_Object key = XCAR (keylist);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3707
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3708 /* Deleted entries get set to nil. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3709 if (!INTEGERP (key))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3710 continue;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3711
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3712 RegisterHotKey (hwnd, HOTKEY_ID (key),
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3713 HOTKEY_MODIFIERS (key), HOTKEY_VK_CODE (key));
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3714 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3715 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3716
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3717 static void
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3718 unregister_hot_keys (hwnd)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3719 HWND hwnd;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3720 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3721 Lisp_Object keylist;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3722
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3723 /* Use GC_CONSP, since we are called asynchronously. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3724 for (keylist = w32_grabbed_keys; GC_CONSP (keylist); keylist = XCDR (keylist))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3725 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3726 Lisp_Object key = XCAR (keylist);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3727
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3728 if (!INTEGERP (key))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3729 continue;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3730
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3731 UnregisterHotKey (hwnd, HOTKEY_ID (key));
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3732 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3733 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3734
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3735 /* Main message dispatch loop. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3736
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3737 static void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3738 w32_msg_pump (deferred_msg * msg_buf)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3739 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3740 MSG msg;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3741 int result;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3742 HWND focus_window;
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3743
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3744 msh_mousewheel = RegisterWindowMessage (MSH_MOUSEWHEEL);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3745
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3746 while (GetMessage (&msg, NULL, 0, 0))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3747 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3748 if (msg.hwnd == NULL)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3749 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3750 switch (msg.message)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3751 {
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3752 case WM_NULL:
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3753 /* Produced by complete_deferred_msg; just ignore. */
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3754 break;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3755 case WM_EMACS_CREATEWINDOW:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3756 w32_createwindow ((struct frame *) msg.wParam);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3757 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3758 abort ();
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3759 break;
21608
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3760 case WM_EMACS_SETLOCALE:
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3761 SetThreadLocale (msg.wParam);
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3762 /* Reply is not expected. */
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3763 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3764 case WM_EMACS_SETKEYBOARDLAYOUT:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3765 result = (int) ActivateKeyboardLayout ((HKL) msg.wParam, 0);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3766 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3767 result, 0))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3768 abort ();
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3769 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3770 case WM_EMACS_REGISTER_HOT_KEY:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3771 focus_window = GetFocus ();
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3772 if (focus_window != NULL)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3773 RegisterHotKey (focus_window,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3774 HOTKEY_ID (msg.wParam),
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3775 HOTKEY_MODIFIERS (msg.wParam),
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3776 HOTKEY_VK_CODE (msg.wParam));
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3777 /* Reply is not expected. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3778 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3779 case WM_EMACS_UNREGISTER_HOT_KEY:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3780 focus_window = GetFocus ();
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3781 if (focus_window != NULL)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3782 UnregisterHotKey (focus_window, HOTKEY_ID (msg.wParam));
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3783 /* Mark item as erased. NB: this code must be
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3784 thread-safe. The next line is okay because the cons
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3785 cell is never made into garbage and is not relocated by
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3786 GC. */
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3787 XCAR ((Lisp_Object) msg.lParam) = Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3788 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3789 abort ();
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3790 break;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3791 case WM_EMACS_TOGGLE_LOCK_KEY:
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3792 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3793 int vk_code = (int) msg.wParam;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3794 int cur_state = (GetKeyState (vk_code) & 1);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3795 Lisp_Object new_state = (Lisp_Object) msg.lParam;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3796
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3797 /* NB: This code must be thread-safe. It is safe to
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3798 call NILP because symbols are not relocated by GC,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3799 and pointer here is not touched by GC (so the markbit
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3800 can't be set). Numbers are safe because they are
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3801 immediate values. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3802 if (NILP (new_state)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3803 || (NUMBERP (new_state)
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
3804 && ((XUINT (new_state)) & 1) != cur_state))
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3805 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3806 one_w32_display_info.faked_key = vk_code;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3807
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3808 keybd_event ((BYTE) vk_code,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3809 (BYTE) MapVirtualKey (vk_code, 0),
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3810 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3811 keybd_event ((BYTE) vk_code,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3812 (BYTE) MapVirtualKey (vk_code, 0),
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3813 KEYEVENTF_EXTENDEDKEY | 0, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3814 keybd_event ((BYTE) vk_code,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3815 (BYTE) MapVirtualKey (vk_code, 0),
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3816 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3817 cur_state = !cur_state;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3818 }
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3819 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3820 cur_state, 0))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3821 abort ();
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3822 }
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3823 break;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3824 default:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3825 DebPrint (("msg %x not expected by w32_msg_pump\n", msg.message));
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3826 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3827 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3828 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3829 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3830 DispatchMessage (&msg);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3831 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3832
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3833 /* Exit nested loop when our deferred message has completed. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3834 if (msg_buf->completed)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3835 break;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3836 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3837 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3838
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3839 deferred_msg * deferred_msg_head;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3840
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3841 static deferred_msg *
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3842 find_deferred_msg (HWND hwnd, UINT msg)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3843 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3844 deferred_msg * item;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3845
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3846 /* Don't actually need synchronization for read access, since
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3847 modification of single pointer is always atomic. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3848 /* enter_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3849
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3850 for (item = deferred_msg_head; item != NULL; item = item->next)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3851 if (item->w32msg.msg.hwnd == hwnd
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3852 && item->w32msg.msg.message == msg)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3853 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3854
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3855 /* leave_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3856
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3857 return item;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3858 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3859
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3860 static LRESULT
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3861 send_deferred_msg (deferred_msg * msg_buf,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3862 HWND hwnd,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3863 UINT msg,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3864 WPARAM wParam,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3865 LPARAM lParam)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3866 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3867 /* Only input thread can send deferred messages. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3868 if (GetCurrentThreadId () != dwWindowsThreadId)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3869 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3870
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3871 /* It is an error to send a message that is already deferred. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3872 if (find_deferred_msg (hwnd, msg) != NULL)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3873 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3874
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3875 /* Enforced synchronization is not needed because this is the only
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3876 function that alters deferred_msg_head, and the following critical
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3877 section is guaranteed to only be serially reentered (since only the
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3878 input thread can call us). */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3879
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3880 /* enter_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3881
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3882 msg_buf->completed = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3883 msg_buf->next = deferred_msg_head;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3884 deferred_msg_head = msg_buf;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3885 my_post_msg (&msg_buf->w32msg, hwnd, msg, wParam, lParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3886
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3887 /* leave_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3888
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3889 /* Start a new nested message loop to process other messages until
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3890 this one is completed. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3891 w32_msg_pump (msg_buf);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3892
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3893 deferred_msg_head = msg_buf->next;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3894
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3895 return msg_buf->result;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3896 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3897
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3898 void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3899 complete_deferred_msg (HWND hwnd, UINT msg, LRESULT result)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3900 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3901 deferred_msg * msg_buf = find_deferred_msg (hwnd, msg);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3902
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3903 if (msg_buf == NULL)
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3904 /* Message may have been cancelled, so don't abort(). */
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3905 return;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3906
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3907 msg_buf->result = result;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3908 msg_buf->completed = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3909
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3910 /* Ensure input thread is woken so it notices the completion. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3911 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3912 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3913
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3914 void
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3915 cancel_all_deferred_msgs ()
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3916 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3917 deferred_msg * item;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3918
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3919 /* Don't actually need synchronization for read access, since
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3920 modification of single pointer is always atomic. */
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3921 /* enter_crit (); */
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3922
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3923 for (item = deferred_msg_head; item != NULL; item = item->next)
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3924 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3925 item->result = 0;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3926 item->completed = 1;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3927 }
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3928
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3929 /* leave_crit (); */
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3930
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3931 /* Ensure input thread is woken so it notices the completion. */
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3932 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0);
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3933 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3934
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3935 DWORD
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3936 w32_msg_worker (dw)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3937 DWORD dw;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3938 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3939 MSG msg;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3940 deferred_msg dummy_buf;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3941
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3942 /* Ensure our message queue is created */
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3943
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3944 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3945
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3946 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3947 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3948
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3949 memset (&dummy_buf, 0, sizeof (dummy_buf));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3950 dummy_buf.w32msg.msg.hwnd = NULL;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3951 dummy_buf.w32msg.msg.message = WM_NULL;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3952
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3953 /* This is the inital message loop which should only exit when the
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3954 application quits. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3955 w32_msg_pump (&dummy_buf);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3956
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3957 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3958 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3959
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3960 static void
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3961 post_character_message (hwnd, msg, wParam, lParam, modifiers)
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3962 HWND hwnd;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3963 UINT msg;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3964 WPARAM wParam;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3965 LPARAM lParam;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3966 DWORD modifiers;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3967
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3968 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3969 W32Msg wmsg;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3970
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3971 wmsg.dwModifiers = modifiers;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3972
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3973 /* Detect quit_char and set quit-flag directly. Note that we
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3974 still need to post a message to ensure the main thread will be
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3975 woken up if blocked in sys_select(), but we do NOT want to post
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3976 the quit_char message itself (because it will usually be as if
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3977 the user had typed quit_char twice). Instead, we post a dummy
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3978 message that has no particular effect. */
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3979 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3980 int c = wParam;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3981 if (isalpha (c) && wmsg.dwModifiers == ctrl_modifier)
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3982 c = make_ctrl_char (c) & 0377;
24339
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
3983 if (c == quit_char
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
3984 || (wmsg.dwModifiers == 0 &&
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
3985 XFASTINT (Vw32_quit_key) && wParam == XFASTINT (Vw32_quit_key)))
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3986 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3987 Vquit_flag = Qt;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3988
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3989 /* The choice of message is somewhat arbitrary, as long as
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3990 the main thread handler just ignores it. */
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3991 msg = WM_NULL;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3992
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3993 /* Interrupt any blocking system calls. */
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3994 signal_quit ();
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3995
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3996 /* As a safety precaution, forcibly complete any deferred
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3997 messages. This is a kludge, but I don't see any particularly
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3998 clean way to handle the situation where a deferred message is
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3999 "dropped" in the lisp thread, and will thus never be
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4000 completed, eg. by the user trying to activate the menubar
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4001 when the lisp thread is busy, and then typing C-g when the
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4002 menubar doesn't open promptly (with the result that the
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4003 menubar never responds at all because the deferred
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4004 WM_INITMENU message is never completed). Another problem
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4005 situation is when the lisp thread calls SendMessage (to send
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4006 a window manager command) when a message has been deferred;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4007 the lisp thread gets blocked indefinitely waiting for the
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4008 deferred message to be completed, which itself is waiting for
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4009 the lisp thread to respond.
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4010
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4011 Note that we don't want to block the input thread waiting for
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4012 a reponse from the lisp thread (although that would at least
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4013 solve the deadlock problem above), because we want to be able
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4014 to receive C-g to interrupt the lisp thread. */
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4015 cancel_all_deferred_msgs ();
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4016 }
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4017 }
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4018
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4019 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4020 }
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
4021
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4022 /* Main window procedure */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4023
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4024 LRESULT CALLBACK
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4025 w32_wnd_proc (hwnd, msg, wParam, lParam)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4026 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4027 UINT msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4028 WPARAM wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4029 LPARAM lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4030 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4031 struct frame *f;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4032 struct w32_display_info *dpyinfo = &one_w32_display_info;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4033 W32Msg wmsg;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4034 int windows_translate;
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4035 int key;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4036
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4037 /* Note that it is okay to call x_window_to_frame, even though we are
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4038 not running in the main lisp thread, because frame deletion
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4039 requires the lisp thread to synchronize with this thread. Thus, if
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4040 a frame struct is returned, it can be used without concern that the
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4041 lisp thread might make it disappear while we are using it.
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4042
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4043 NB. Walking the frame list in this thread is safe (as long as
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4044 writes of Lisp_Object slots are atomic, which they are on Windows).
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4045 Although delete-frame can destructively modify the frame list while
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4046 we are walking it, a garbage collection cannot occur until after
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4047 delete-frame has synchronized with this thread.
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4048
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4049 It is also safe to use functions that make GDI calls, such as
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4050 w32_clear_rect, because these functions must obtain a DC handle
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4051 from the frame struct using get_frame_dc which is thread-aware. */
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4052
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4053 switch (msg)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4054 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4055 case WM_ERASEBKGND:
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4056 f = x_window_to_frame (dpyinfo, hwnd);
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4057 if (f)
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4058 {
27407
7df920562cbe (w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents: 27397
diff changeset
4059 HDC hdc = get_frame_dc (f);
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4060 GetUpdateRect (hwnd, &wmsg.rect, FALSE);
27407
7df920562cbe (w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents: 27397
diff changeset
4061 w32_clear_rect (f, hdc, &wmsg.rect);
7df920562cbe (w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents: 27397
diff changeset
4062 release_frame_dc (f, hdc);
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4063
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4064 #if defined (W32_DEBUG_DISPLAY)
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4065 DebPrint (("WM_ERASEBKGND: erasing %d,%d-%d,%d\n",
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4066 wmsg.rect.left, wmsg.rect.top, wmsg.rect.right,
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4067 wmsg.rect.bottom));
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4068 #endif /* W32_DEBUG_DISPLAY */
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4069 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4070 return 1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4071 case WM_PALETTECHANGED:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4072 /* ignore our own changes */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4073 if ((HWND)wParam != hwnd)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4074 {
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4075 f = x_window_to_frame (dpyinfo, hwnd);
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4076 if (f)
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4077 /* get_frame_dc will realize our palette and force all
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4078 frames to be redrawn if needed. */
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
4079 release_frame_dc (f, get_frame_dc (f));
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4080 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4081 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4082 case WM_PAINT:
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4083 {
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4084 PAINTSTRUCT paintStruct;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4085 RECT update_rect;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4086
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4087 /* MSDN Docs say not to call BeginPaint if GetUpdateRect
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4088 fails. Apparently this can happen under some
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4089 circumstances. */
24695
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
4090 if (!w32_strict_painting || GetUpdateRect (hwnd, &update_rect, FALSE))
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4091 {
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4092 enter_crit ();
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4093 BeginPaint (hwnd, &paintStruct);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4094
24695
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
4095 if (w32_strict_painting)
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
4096 /* The rectangles returned by GetUpdateRect and BeginPaint
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
4097 do not always match. GetUpdateRect seems to be the
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
4098 more reliable of the two. */
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
4099 wmsg.rect = update_rect;
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
4100 else
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
4101 wmsg.rect = paintStruct.rcPaint;
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4102
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4103 #if defined (W32_DEBUG_DISPLAY)
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4104 DebPrint (("WM_PAINT: painting %d,%d-%d,%d\n", wmsg.rect.left,
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4105 wmsg.rect.top, wmsg.rect.right, wmsg.rect.bottom));
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4106 DebPrint (("WM_PAINT: update region is %d,%d-%d,%d\n",
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4107 update_rect.left, update_rect.top,
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4108 update_rect.right, update_rect.bottom));
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4109 #endif
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4110 EndPaint (hwnd, &paintStruct);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4111 leave_crit ();
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4112
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4113 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4114
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4115 return 0;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4116 }
24695
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
4117
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
4118 /* If GetUpdateRect returns 0 (meaning there is no update
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
4119 region), assume the whole window needs to be repainted. */
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
4120 GetClientRect(hwnd, &wmsg.rect);
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
4121 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
4122 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4123 }
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
4124
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4125 case WM_INPUTLANGCHANGE:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4126 /* Inform lisp thread of keyboard layout changes. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4127 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4128
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4129 /* Clear dead keys in the keyboard state; for simplicity only
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4130 preserve modifier key states. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4131 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4132 int i;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4133 BYTE keystate[256];
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4134
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4135 GetKeyboardState (keystate);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4136 for (i = 0; i < 256; i++)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4137 if (1
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4138 && i != VK_SHIFT
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4139 && i != VK_LSHIFT
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4140 && i != VK_RSHIFT
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4141 && i != VK_CAPITAL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4142 && i != VK_NUMLOCK
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4143 && i != VK_SCROLL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4144 && i != VK_CONTROL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4145 && i != VK_LCONTROL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4146 && i != VK_RCONTROL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4147 && i != VK_MENU
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4148 && i != VK_LMENU
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4149 && i != VK_RMENU
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4150 && i != VK_LWIN
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4151 && i != VK_RWIN)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4152 keystate[i] = 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4153 SetKeyboardState (keystate);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4154 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4155 goto dflt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4156
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4157 case WM_HOTKEY:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4158 /* Synchronize hot keys with normal input. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4159 PostMessage (hwnd, WM_KEYDOWN, HIWORD (lParam), 0);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4160 return (0);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4161
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
4162 case WM_KEYUP:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
4163 case WM_SYSKEYUP:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
4164 record_keyup (wParam, lParam);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
4165 goto dflt;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
4166
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4167 case WM_KEYDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4168 case WM_SYSKEYDOWN:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4169 /* Ignore keystrokes we fake ourself; see below. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4170 if (dpyinfo->faked_key == wParam)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4171 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4172 dpyinfo->faked_key = 0;
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4173 /* Make sure TranslateMessage sees them though (as long as
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4174 they don't produce WM_CHAR messages). This ensures that
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4175 indicator lights are toggled promptly on Windows 9x, for
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4176 example. */
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4177 if (lispy_function_keys[wParam] != 0)
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4178 {
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4179 windows_translate = 1;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4180 goto translate;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4181 }
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4182 return 0;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4183 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4184
15377
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
4185 /* Synchronize modifiers with current keystroke. */
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
4186 sync_modifiers ();
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
4187 record_keydown (wParam, lParam);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4188 wParam = map_keypad_keys (wParam, (lParam & 0x1000000L) != 0);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4189
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4190 windows_translate = 0;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4191
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4192 switch (wParam)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4193 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4194 case VK_LWIN:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4195 if (NILP (Vw32_pass_lwindow_to_system))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4196 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4197 /* Prevent system from acting on keyup (which opens the
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4198 Start menu if no other key was pressed) by simulating a
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4199 press of Space which we will ignore. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4200 if (GetAsyncKeyState (wParam) & 1)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4201 {
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4202 if (NUMBERP (Vw32_phantom_key_code))
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4203 key = XUINT (Vw32_phantom_key_code) & 255;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4204 else
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4205 key = VK_SPACE;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4206 dpyinfo->faked_key = key;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4207 keybd_event (key, (BYTE) MapVirtualKey (key, 0), 0, 0);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4208 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4209 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4210 if (!NILP (Vw32_lwindow_modifier))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4211 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4212 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4213 case VK_RWIN:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4214 if (NILP (Vw32_pass_rwindow_to_system))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4215 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4216 if (GetAsyncKeyState (wParam) & 1)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4217 {
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4218 if (NUMBERP (Vw32_phantom_key_code))
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4219 key = XUINT (Vw32_phantom_key_code) & 255;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4220 else
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4221 key = VK_SPACE;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4222 dpyinfo->faked_key = key;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4223 keybd_event (key, (BYTE) MapVirtualKey (key, 0), 0, 0);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4224 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4225 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4226 if (!NILP (Vw32_rwindow_modifier))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4227 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4228 break;
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
4229 case VK_APPS:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4230 if (!NILP (Vw32_apps_modifier))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4231 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4232 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4233 case VK_MENU:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4234 if (NILP (Vw32_pass_alt_to_system))
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4235 /* Prevent DefWindowProc from activating the menu bar if an
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4236 Alt key is pressed and released by itself. */
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4237 return 0;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4238 windows_translate = 1;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4239 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4240 case VK_CAPITAL:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4241 /* Decide whether to treat as modifier or function key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4242 if (NILP (Vw32_enable_caps_lock))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4243 goto disable_lock_key;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4244 windows_translate = 1;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4245 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4246 case VK_NUMLOCK:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4247 /* Decide whether to treat as modifier or function key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4248 if (NILP (Vw32_enable_num_lock))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4249 goto disable_lock_key;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4250 windows_translate = 1;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4251 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4252 case VK_SCROLL:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4253 /* Decide whether to treat as modifier or function key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4254 if (NILP (Vw32_scroll_lock_modifier))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4255 goto disable_lock_key;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4256 windows_translate = 1;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4257 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4258 disable_lock_key:
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4259 /* Ensure the appropriate lock key state (and indicator light)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4260 remains in the same state. We do this by faking another
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4261 press of the relevant key. Apparently, this really is the
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4262 only way to toggle the state of the indicator lights. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4263 dpyinfo->faked_key = wParam;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4264 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0),
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4265 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4266 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0),
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4267 KEYEVENTF_EXTENDEDKEY | 0, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4268 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0),
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4269 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4270 /* Ensure indicator lights are updated promptly on Windows 9x
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4271 (TranslateMessage apparently does this), after forwarding
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4272 input event. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4273 post_character_message (hwnd, msg, wParam, lParam,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4274 w32_get_key_modifiers (wParam, lParam));
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4275 windows_translate = 1;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4276 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4277 case VK_CONTROL:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4278 case VK_SHIFT:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4279 case VK_PROCESSKEY: /* Generated by IME. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4280 windows_translate = 1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4281 break;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4282 case VK_CANCEL:
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4283 /* Windows maps Ctrl-Pause (aka Ctrl-Break) into VK_CANCEL,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4284 which is confusing for purposes of key binding; convert
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4285 VK_CANCEL events into VK_PAUSE events. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4286 wParam = VK_PAUSE;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4287 break;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4288 case VK_PAUSE:
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4289 /* Windows maps Ctrl-NumLock into VK_PAUSE, which is confusing
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4290 for purposes of key binding; convert these back into
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4291 VK_NUMLOCK events, at least when we want to see NumLock key
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4292 presses. (Note that there is never any possibility that
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4293 VK_PAUSE with Ctrl really is C-Pause as per above.) */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4294 if (NILP (Vw32_enable_num_lock) && modifier_set (VK_CONTROL))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4295 wParam = VK_NUMLOCK;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4296 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4297 default:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4298 /* If not defined as a function key, change it to a WM_CHAR message. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4299 if (lispy_function_keys[wParam] == 0)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4300 {
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4301 DWORD modifiers = construct_console_modifiers ();
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4302
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4303 if (!NILP (Vw32_recognize_altgr)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4304 && modifier_set (VK_LCONTROL) && modifier_set (VK_RMENU))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4305 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4306 /* Always let TranslateMessage handle AltGr key chords;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4307 for some reason, ToAscii doesn't always process AltGr
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4308 chords correctly. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4309 windows_translate = 1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4310 }
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4311 else if ((modifiers & (~SHIFT_PRESSED & ~CAPSLOCK_ON)) != 0)
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4312 {
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4313 /* Handle key chords including any modifiers other
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4314 than shift directly, in order to preserve as much
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4315 modifier information as possible. */
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4316 if ('A' <= wParam && wParam <= 'Z')
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4317 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4318 /* Don't translate modified alphabetic keystrokes,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4319 so the user doesn't need to constantly switch
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4320 layout to type control or meta keystrokes when
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4321 the normal layout translates alphabetic
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4322 characters to non-ascii characters. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4323 if (!modifier_set (VK_SHIFT))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4324 wParam += ('a' - 'A');
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4325 msg = WM_CHAR;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4326 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4327 else
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4328 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4329 /* Try to handle other keystrokes by determining the
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4330 base character (ie. translating the base key plus
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4331 shift modifier). */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4332 int add;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4333 int isdead = 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4334 KEY_EVENT_RECORD key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4335
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4336 key.bKeyDown = TRUE;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4337 key.wRepeatCount = 1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4338 key.wVirtualKeyCode = wParam;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4339 key.wVirtualScanCode = (lParam & 0xFF0000) >> 16;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4340 key.uChar.AsciiChar = 0;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4341 key.dwControlKeyState = modifiers;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4342
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4343 add = w32_kbd_patch_key (&key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4344 /* 0 means an unrecognised keycode, negative means
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4345 dead key. Ignore both. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4346 while (--add >= 0)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4347 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4348 /* Forward asciified character sequence. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4349 post_character_message
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4350 (hwnd, WM_CHAR, key.uChar.AsciiChar, lParam,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4351 w32_get_key_modifiers (wParam, lParam));
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4352 w32_kbd_patch_key (&key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4353 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4354 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4355 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4356 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4357 else
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4358 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4359 /* Let TranslateMessage handle everything else. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4360 windows_translate = 1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4361 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4362 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4363 }
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
4364
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4365 translate:
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4366 if (windows_translate)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4367 {
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
4368 MSG windows_msg = { hwnd, msg, wParam, lParam, 0, {0,0} };
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
4369
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
4370 windows_msg.time = GetMessageTime ();
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
4371 TranslateMessage (&windows_msg);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4372 goto dflt;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4373 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4374
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4375 /* Fall through */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4376
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4377 case WM_SYSCHAR:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4378 case WM_CHAR:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4379 post_character_message (hwnd, msg, wParam, lParam,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4380 w32_get_key_modifiers (wParam, lParam));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4381 break;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
4382
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4383 /* Simulate middle mouse button events when left and right buttons
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4384 are used together, but only if user has two button mouse. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4385 case WM_LBUTTONDOWN:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4386 case WM_RBUTTONDOWN:
27894
6c4ff3519d09 (w32_wnd_proc) [WM_LBUTTON_DOWN, WM_RBUTTON_DOWN, WM_LBUTTON_UP,
Jason Rumney <jasonr@gnu.org>
parents: 27516
diff changeset
4387 if (XINT (Vw32_num_mouse_buttons) > 2)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4388 goto handle_plain_button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4389
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4390 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4391 int this = (msg == WM_LBUTTONDOWN) ? LMOUSE : RMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4392 int other = (msg == WM_LBUTTONDOWN) ? RMOUSE : LMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4393
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4394 if (button_state & this)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4395 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4396
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4397 if (button_state == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4398 SetCapture (hwnd);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4399
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4400 button_state |= this;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4401
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4402 if (button_state & other)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4403 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4404 if (mouse_button_timer)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4405 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4406 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4407 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4408
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4409 /* Generate middle mouse event instead. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4410 msg = WM_MBUTTONDOWN;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4411 button_state |= MMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4412 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4413 else if (button_state & MMOUSE)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4414 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4415 /* Ignore button event if we've already generated a
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4416 middle mouse down event. This happens if the
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4417 user releases and press one of the two buttons
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4418 after we've faked a middle mouse event. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4419 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4420 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4421 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4422 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4423 /* Flush out saved message. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4424 post_msg (&saved_mouse_button_msg);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4425 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4426 wmsg.dwModifiers = w32_get_modifiers ();
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4427 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4428
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4429 /* Clear message buffer. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4430 saved_mouse_button_msg.msg.hwnd = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4431 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4432 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4433 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4434 /* Hold onto message for now. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4435 mouse_button_timer =
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4436 SetTimer (hwnd, MOUSE_BUTTON_ID,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4437 XINT (Vw32_mouse_button_tolerance), NULL);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4438 saved_mouse_button_msg.msg.hwnd = hwnd;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4439 saved_mouse_button_msg.msg.message = msg;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4440 saved_mouse_button_msg.msg.wParam = wParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4441 saved_mouse_button_msg.msg.lParam = lParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4442 saved_mouse_button_msg.msg.time = GetMessageTime ();
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4443 saved_mouse_button_msg.dwModifiers = w32_get_modifiers ();
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4444 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4445 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4446 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4447
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4448 case WM_LBUTTONUP:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4449 case WM_RBUTTONUP:
27894
6c4ff3519d09 (w32_wnd_proc) [WM_LBUTTON_DOWN, WM_RBUTTON_DOWN, WM_LBUTTON_UP,
Jason Rumney <jasonr@gnu.org>
parents: 27516
diff changeset
4450 if (XINT (Vw32_num_mouse_buttons) > 2)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4451 goto handle_plain_button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4452
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4453 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4454 int this = (msg == WM_LBUTTONUP) ? LMOUSE : RMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4455 int other = (msg == WM_LBUTTONUP) ? RMOUSE : LMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4456
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4457 if ((button_state & this) == 0)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4458 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4459
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4460 button_state &= ~this;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4461
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4462 if (button_state & MMOUSE)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4463 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4464 /* Only generate event when second button is released. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4465 if ((button_state & other) == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4466 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4467 msg = WM_MBUTTONUP;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4468 button_state &= ~MMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4469
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4470 if (button_state) abort ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4471 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4472 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4473 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4474 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4475 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4476 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4477 /* Flush out saved message if necessary. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4478 if (saved_mouse_button_msg.msg.hwnd)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4479 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4480 post_msg (&saved_mouse_button_msg);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4481 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4482 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4483 wmsg.dwModifiers = w32_get_modifiers ();
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4484 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4485
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4486 /* Always clear message buffer and cancel timer. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4487 saved_mouse_button_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4488 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4489 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4490
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4491 if (button_state == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4492 ReleaseCapture ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4493 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4494 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4495
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4496 case WM_MBUTTONDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4497 case WM_MBUTTONUP:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4498 handle_plain_button:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4499 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4500 BOOL up;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4501 int button;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4502
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4503 if (parse_button (msg, &button, &up))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4504 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4505 if (up) ReleaseCapture ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4506 else SetCapture (hwnd);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4507 button = (button == 0) ? LMOUSE :
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4508 ((button == 1) ? MMOUSE : RMOUSE);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4509 if (up)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4510 button_state &= ~button;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4511 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4512 button_state |= button;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4513 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4514 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4515
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4516 wmsg.dwModifiers = w32_get_modifiers ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4517 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4518 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4519
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4520 case WM_VSCROLL:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4521 case WM_MOUSEMOVE:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4522 if (XINT (Vw32_mouse_move_interval) <= 0
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4523 || (msg == WM_MOUSEMOVE && button_state == 0))
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4524 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4525 wmsg.dwModifiers = w32_get_modifiers ();
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4526 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4527 return 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4528 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4529
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4530 /* Hang onto mouse move and scroll messages for a bit, to avoid
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4531 sending such events to Emacs faster than it can process them.
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4532 If we get more events before the timer from the first message
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4533 expires, we just replace the first message. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4534
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4535 if (saved_mouse_move_msg.msg.hwnd == 0)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4536 mouse_move_timer =
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4537 SetTimer (hwnd, MOUSE_MOVE_ID,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4538 XINT (Vw32_mouse_move_interval), NULL);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4539
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4540 /* Hold onto message for now. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4541 saved_mouse_move_msg.msg.hwnd = hwnd;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4542 saved_mouse_move_msg.msg.message = msg;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4543 saved_mouse_move_msg.msg.wParam = wParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4544 saved_mouse_move_msg.msg.lParam = lParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4545 saved_mouse_move_msg.msg.time = GetMessageTime ();
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4546 saved_mouse_move_msg.dwModifiers = w32_get_modifiers ();
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4547
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4548 return 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4549
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4550 case WM_MOUSEWHEEL:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4551 wmsg.dwModifiers = w32_get_modifiers ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4552 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4553 return 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4554
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
4555 case WM_DROPFILES:
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
4556 wmsg.dwModifiers = w32_get_modifiers ();
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
4557 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
4558 return 0;
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
4559
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4560 case WM_TIMER:
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4561 /* Flush out saved messages if necessary. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4562 if (wParam == mouse_button_timer)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4563 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4564 if (saved_mouse_button_msg.msg.hwnd)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4565 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4566 post_msg (&saved_mouse_button_msg);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4567 saved_mouse_button_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4568 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4569 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4570 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4571 }
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4572 else if (wParam == mouse_move_timer)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4573 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4574 if (saved_mouse_move_msg.msg.hwnd)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4575 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4576 post_msg (&saved_mouse_move_msg);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4577 saved_mouse_move_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4578 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4579 KillTimer (hwnd, mouse_move_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4580 mouse_move_timer = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4581 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4582 return 0;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4583
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4584 case WM_NCACTIVATE:
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4585 /* Windows doesn't send us focus messages when putting up and
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
4586 taking down a system popup dialog as for Ctrl-Alt-Del on Windows 95.
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4587 The only indication we get that something happened is receiving
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4588 this message afterwards. So this is a good time to reset our
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4589 keyboard modifiers' state. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4590 reset_modifiers ();
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4591 goto dflt;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4592
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4593 case WM_INITMENU:
24751
e0eaca5025bc (w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents: 24718
diff changeset
4594 button_state = 0;
e0eaca5025bc (w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents: 24718
diff changeset
4595 ReleaseCapture ();
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4596 /* We must ensure menu bar is fully constructed and up to date
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4597 before allowing user interaction with it. To achieve this
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4598 we send this message to the lisp thread and wait for a
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4599 reply (whose value is not actually needed) to indicate that
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4600 the menu bar is now ready for use, so we can now return.
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4601
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4602 To remain responsive in the meantime, we enter a nested message
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4603 loop that can process all other messages.
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4604
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4605 However, we skip all this if the message results from calling
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4606 TrackPopupMenu - in fact, we must NOT attempt to send the lisp
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4607 thread a message because it is blocked on us at this point. We
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4608 set menubar_active before calling TrackPopupMenu to indicate
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4609 this (there is no possibility of confusion with real menubar
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4610 being active). */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4611
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4612 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4613 if (f
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4614 && (f->output_data.w32->menubar_active
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4615 /* We can receive this message even in the absence of a
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4616 menubar (ie. when the system menu is activated) - in this
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4617 case we do NOT want to forward the message, otherwise it
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4618 will cause the menubar to suddenly appear when the user
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4619 had requested it to be turned off! */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4620 || f->output_data.w32->menubar_widget == NULL))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4621 return 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4622
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4623 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4624 deferred_msg msg_buf;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4625
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4626 /* Detect if message has already been deferred; in this case
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4627 we cannot return any sensible value to ignore this. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4628 if (find_deferred_msg (hwnd, msg) != NULL)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4629 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4630
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4631 return send_deferred_msg (&msg_buf, hwnd, msg, wParam, lParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4632 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4633
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4634 case WM_EXITMENULOOP:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4635 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4636
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4637 /* Indicate that menubar can be modified again. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4638 if (f)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4639 f->output_data.w32->menubar_active = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4640 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4641
28272
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
4642 case WM_MENUSELECT:
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
4643 wmsg.dwModifiers = w32_get_modifiers ();
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
4644 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
4645 return 0;
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
4646
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4647 case WM_MEASUREITEM:
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4648 f = x_window_to_frame (dpyinfo, hwnd);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4649 if (f)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4650 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4651 MEASUREITEMSTRUCT * pMis = (MEASUREITEMSTRUCT *) lParam;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4652
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4653 if (pMis->CtlType == ODT_MENU)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4654 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4655 /* Work out dimensions for popup menu titles. */
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4656 char * title = (char *) pMis->itemData;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4657 HDC hdc = GetDC (hwnd);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4658 HFONT menu_font = GetCurrentObject (hdc, OBJ_FONT);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4659 LOGFONT menu_logfont;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4660 HFONT old_font;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4661 SIZE size;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4662
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4663 GetObject (menu_font, sizeof (menu_logfont), &menu_logfont);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4664 menu_logfont.lfWeight = FW_BOLD;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4665 menu_font = CreateFontIndirect (&menu_logfont);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4666 old_font = SelectObject (hdc, menu_font);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4667
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4668 pMis->itemHeight = GetSystemMetrics (SM_CYMENUSIZE);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4669 if (title)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4670 {
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4671 GetTextExtentPoint32 (hdc, title, strlen (title), &size);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4672 pMis->itemWidth = size.cx;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4673 if (pMis->itemHeight < size.cy)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4674 pMis->itemHeight = size.cy;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4675 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4676 else
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4677 pMis->itemWidth = 0;
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4678
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4679 SelectObject (hdc, old_font);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4680 DeleteObject (menu_font);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4681 ReleaseDC (hwnd, hdc);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4682 return TRUE;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4683 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4684 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4685 return 0;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4686
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4687 case WM_DRAWITEM:
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4688 f = x_window_to_frame (dpyinfo, hwnd);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4689 if (f)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4690 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4691 DRAWITEMSTRUCT * pDis = (DRAWITEMSTRUCT *) lParam;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4692
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4693 if (pDis->CtlType == ODT_MENU)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4694 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4695 /* Draw popup menu title. */
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4696 char * title = (char *) pDis->itemData;
30239
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4697 if (title)
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4698 {
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4699 HDC hdc = pDis->hDC;
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4700 HFONT menu_font = GetCurrentObject (hdc, OBJ_FONT);
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4701 LOGFONT menu_logfont;
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4702 HFONT old_font;
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4703
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4704 GetObject (menu_font, sizeof (menu_logfont), &menu_logfont);
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4705 menu_logfont.lfWeight = FW_BOLD;
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4706 menu_font = CreateFontIndirect (&menu_logfont);
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4707 old_font = SelectObject (hdc, menu_font);
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4708
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4709 /* Always draw title as if not selected. */
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4710 ExtTextOut (hdc,
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4711 pDis->rcItem.left
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4712 + GetSystemMetrics (SM_CXMENUCHECK),
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4713 pDis->rcItem.top,
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4714 ETO_OPAQUE, &pDis->rcItem,
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4715 title, strlen (title), NULL);
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4716
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4717 SelectObject (hdc, old_font);
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4718 DeleteObject (menu_font);
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
4719 }
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4720 return TRUE;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4721 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4722 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4723 return 0;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4724
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4725 #if 0
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4726 /* Still not right - can't distinguish between clicks in the
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4727 client area of the frame from clicks forwarded from the scroll
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4728 bars - may have to hook WM_NCHITTEST to remember the mouse
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4729 position and then check if it is in the client area ourselves. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4730 case WM_MOUSEACTIVATE:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4731 /* Discard the mouse click that activates a frame, allowing the
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4732 user to click anywhere without changing point (or worse!).
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4733 Don't eat mouse clicks on scrollbars though!! */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4734 if (LOWORD (lParam) == HTCLIENT )
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4735 return MA_ACTIVATEANDEAT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4736 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4737 #endif
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4738
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4739 case WM_ACTIVATEAPP:
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4740 case WM_ACTIVATE:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4741 case WM_WINDOWPOSCHANGED:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4742 case WM_SHOWWINDOW:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4743 /* Inform lisp thread that a frame might have just been obscured
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4744 or exposed, so should recheck visibility of all frames. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4745 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4746 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4747
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
4748 case WM_SETFOCUS:
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4749 dpyinfo->faked_key = 0;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4750 reset_modifiers ();
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4751 register_hot_keys (hwnd);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4752 goto command;
15314
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
4753 case WM_KILLFOCUS:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4754 unregister_hot_keys (hwnd);
24751
e0eaca5025bc (w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents: 24718
diff changeset
4755 button_state = 0;
e0eaca5025bc (w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents: 24718
diff changeset
4756 ReleaseCapture ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4757 case WM_MOVE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4758 case WM_SIZE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4759 case WM_COMMAND:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4760 command:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4761 wmsg.dwModifiers = w32_get_modifiers ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4762 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4763 goto dflt;
15034
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
4764
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
4765 case WM_CLOSE:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4766 wmsg.dwModifiers = w32_get_modifiers ();
15034
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
4767 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
4768 return 0;
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
4769
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4770 case WM_WINDOWPOSCHANGING:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4771 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4772 WINDOWPLACEMENT wp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4773 LPWINDOWPOS lppos = (WINDOWPOS *) lParam;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4774
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4775 wp.length = sizeof (WINDOWPLACEMENT);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4776 GetWindowPlacement (hwnd, &wp);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4777
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4778 if (wp.showCmd != SW_SHOWMINIMIZED && (lppos->flags & SWP_NOSIZE) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4779 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4780 RECT rect;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4781 int wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4782 int hdiff;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4783 DWORD font_width;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4784 DWORD line_height;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4785 DWORD internal_border;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4786 DWORD scrollbar_extra;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4787 RECT wr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4788
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4789 wp.length = sizeof(wp);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4790 GetWindowRect (hwnd, &wr);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4791
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4792 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4793
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4794 font_width = GetWindowLong (hwnd, WND_FONTWIDTH_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4795 line_height = GetWindowLong (hwnd, WND_LINEHEIGHT_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4796 internal_border = GetWindowLong (hwnd, WND_BORDER_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4797 scrollbar_extra = GetWindowLong (hwnd, WND_SCROLLBAR_INDEX);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4798
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4799 leave_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4800
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4801 memset (&rect, 0, sizeof (rect));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4802 AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4803 GetMenu (hwnd) != NULL);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4804
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4805 /* Force width and height of client area to be exact
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4806 multiples of the character cell dimensions. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4807 wdiff = (lppos->cx - (rect.right - rect.left)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4808 - 2 * internal_border - scrollbar_extra)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4809 % font_width;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4810 hdiff = (lppos->cy - (rect.bottom - rect.top)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4811 - 2 * internal_border)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4812 % line_height;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4813
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4814 if (wdiff || hdiff)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4815 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4816 /* For right/bottom sizing we can just fix the sizes.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4817 However for top/left sizing we will need to fix the X
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4818 and Y positions as well. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4819
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4820 lppos->cx -= wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4821 lppos->cy -= hdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4822
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4823 if (wp.showCmd != SW_SHOWMAXIMIZED
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4824 && (lppos->flags & SWP_NOMOVE) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4825 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4826 if (lppos->x != wr.left || lppos->y != wr.top)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4827 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4828 lppos->x += wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4829 lppos->y += hdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4830 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4831 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4832 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4833 lppos->flags |= SWP_NOMOVE;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4834 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4835 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4836
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4837 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4838 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4839 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4840 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4841
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4842 goto dflt;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4843
24479
3b2c3636bf0e (w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24412
diff changeset
4844 case WM_GETMINMAXINFO:
3b2c3636bf0e (w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24412
diff changeset
4845 /* Hack to correct bug that allows Emacs frames to be resized
3b2c3636bf0e (w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24412
diff changeset
4846 below the Minimum Tracking Size. */
3b2c3636bf0e (w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24412
diff changeset
4847 ((LPMINMAXINFO) lParam)->ptMinTrackSize.y++;
36080
743534626f73 (w32_wnd_proc) <WM_GETMINMAXINFO>: Allow resizing the
Andrew Innes <andrewi@gnu.org>
parents: 36000
diff changeset
4848 /* Hack to allow resizing the Emacs frame above the screen size.
743534626f73 (w32_wnd_proc) <WM_GETMINMAXINFO>: Allow resizing the
Andrew Innes <andrewi@gnu.org>
parents: 36000
diff changeset
4849 Note that Windows 9x limits coordinates to 16-bits. */
743534626f73 (w32_wnd_proc) <WM_GETMINMAXINFO>: Allow resizing the
Andrew Innes <andrewi@gnu.org>
parents: 36000
diff changeset
4850 ((LPMINMAXINFO) lParam)->ptMaxTrackSize.x = 32767;
743534626f73 (w32_wnd_proc) <WM_GETMINMAXINFO>: Allow resizing the
Andrew Innes <andrewi@gnu.org>
parents: 36000
diff changeset
4851 ((LPMINMAXINFO) lParam)->ptMaxTrackSize.y = 32767;
24479
3b2c3636bf0e (w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24412
diff changeset
4852 return 0;
3b2c3636bf0e (w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24412
diff changeset
4853
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4854 case WM_EMACS_CREATESCROLLBAR:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4855 return (LRESULT) w32_createscrollbar ((struct frame *) wParam,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4856 (struct scroll_bar *) lParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4857
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4858 case WM_EMACS_SHOWWINDOW:
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4859 return ShowWindow ((HWND) wParam, (WPARAM) lParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4860
21608
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
4861 case WM_EMACS_SETFOREGROUND:
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4862 {
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4863 HWND foreground_window;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4864 DWORD foreground_thread, retval;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4865
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4866 /* On NT 5.0, and apparently Windows 98, it is necessary to
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4867 attach to the thread that currently has focus in order to
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4868 pull the focus away from it. */
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4869 foreground_window = GetForegroundWindow ();
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4870 foreground_thread = GetWindowThreadProcessId (foreground_window, NULL);
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4871 if (!foreground_window
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4872 || foreground_thread == GetCurrentThreadId ()
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4873 || !AttachThreadInput (GetCurrentThreadId (),
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4874 foreground_thread, TRUE))
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4875 foreground_thread = 0;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4876
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4877 retval = SetForegroundWindow ((HWND) wParam);
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4878
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4879 /* Detach from the previous foreground thread. */
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4880 if (foreground_thread)
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4881 AttachThreadInput (GetCurrentThreadId (),
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4882 foreground_thread, FALSE);
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4883
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4884 return retval;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4885 }
21608
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
4886
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4887 case WM_EMACS_SETWINDOWPOS:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4888 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4889 WINDOWPOS * pos = (WINDOWPOS *) wParam;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4890 return SetWindowPos (hwnd, pos->hwndInsertAfter,
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4891 pos->x, pos->y, pos->cx, pos->cy, pos->flags);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4892 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4893
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4894 case WM_EMACS_DESTROYWINDOW:
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
4895 DragAcceptFiles ((HWND) wParam, FALSE);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4896 return DestroyWindow ((HWND) wParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4897
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4898 case WM_EMACS_TRACKPOPUPMENU:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4899 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4900 UINT flags;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4901 POINT *pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4902 int retval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4903 pos = (POINT *)lParam;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4904 flags = TPM_CENTERALIGN;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4905 if (button_state & LMOUSE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4906 flags |= TPM_LEFTBUTTON;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4907 else if (button_state & RMOUSE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4908 flags |= TPM_RIGHTBUTTON;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4909
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4910 /* Remember we did a SetCapture on the initial mouse down event,
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4911 so for safety, we make sure the capture is cancelled now. */
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4912 ReleaseCapture ();
23160
95a213639589 (w32_wnd_proc): Always zero button_state when releasing
Geoff Voelker <voelker@cs.washington.edu>
parents: 22625
diff changeset
4913 button_state = 0;
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4914
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4915 /* Use menubar_active to indicate that WM_INITMENU is from
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4916 TrackPopupMenu below, and should be ignored. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4917 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4918 if (f)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4919 f->output_data.w32->menubar_active = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4920
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4921 if (TrackPopupMenu ((HMENU)wParam, flags, pos->x, pos->y,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4922 0, hwnd, NULL))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4923 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4924 MSG amsg;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4925 /* Eat any mouse messages during popupmenu */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4926 while (PeekMessage (&amsg, hwnd, WM_MOUSEFIRST, WM_MOUSELAST,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4927 PM_REMOVE));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4928 /* Get the menu selection, if any */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4929 if (PeekMessage (&amsg, hwnd, WM_COMMAND, WM_COMMAND, PM_REMOVE))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4930 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4931 retval = LOWORD (amsg.wParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4932 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4933 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4934 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4935 retval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4936 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4937 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4938 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4939 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4940 retval = -1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4941 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4942
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4943 return retval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4944 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4945
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4946 default:
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4947 /* Check for messages registered at runtime. */
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4948 if (msg == msh_mousewheel)
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4949 {
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4950 wmsg.dwModifiers = w32_get_modifiers ();
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4951 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4952 return 0;
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4953 }
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4954
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4955 dflt:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4956 return DefWindowProc (hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4957 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4958
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4959
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4960 /* The most common default return code for handled messages is 0. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4961 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4962 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4963
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4964 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4965 my_create_window (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4966 struct frame * f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4967 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4968 MSG msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4969
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4970 if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW, (WPARAM)f, 0))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4971 abort ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4972 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4973 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4974
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4975 /* Create and set up the w32 window for frame F. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4976
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4977 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4978 w32_window (f, window_prompting, minibuffer_only)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4979 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4980 long window_prompting;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4981 int minibuffer_only;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4982 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4983 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4984
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4985 /* Use the resource name as the top-level window name
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4986 for looking up resources. Make a non-Lisp copy
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4987 for the window manager, so GC relocation won't bother it.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4988
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4989 Elsewhere we specify the window name for the window manager. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4990
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4991 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4992 char *str = (char *) XSTRING (Vx_resource_name)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4993 f->namebuf = (char *) xmalloc (strlen (str) + 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4994 strcpy (f->namebuf, str);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4995 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4996
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4997 my_create_window (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4998
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4999 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5000
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5001 /* x_set_name normally ignores requests to set the name if the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5002 requested name is the same as the current name. This is the one
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5003 place where that assumption isn't correct; f->name is set, but
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5004 the server hasn't been told. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5005 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5006 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5007 int explicit = f->explicit_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5008
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5009 f->explicit_name = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5010 name = f->name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5011 f->name = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5012 x_set_name (f, name, explicit);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5013 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5014
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5015 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5016
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5017 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5018 initialize_frame_menubar (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5019
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5020 if (FRAME_W32_WINDOW (f) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5021 error ("Unable to create window");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5022 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5023
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5024 /* Handle the icon stuff for this window. Perhaps later we might
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5025 want an x_set_icon_position which can be called interactively as
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5026 well. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5027
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5028 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5029 x_icon (f, parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5030 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5031 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5032 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5033 Lisp_Object icon_x, icon_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5034
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
5035 /* Set the position of the icon. Note that Windows 95 groups all
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5036 icons in the tray. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5037 icon_x = w32_get_arg (parms, Qicon_left, 0, 0, RES_TYPE_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5038 icon_y = w32_get_arg (parms, Qicon_top, 0, 0, RES_TYPE_NUMBER);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5039 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5040 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5041 CHECK_NUMBER (icon_x, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5042 CHECK_NUMBER (icon_y, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5043 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5044 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5045 error ("Both left and top icon corners of icon must be specified");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5046
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5047 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5048
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5049 if (! EQ (icon_x, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5050 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5051
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5052 #if 0 /* TODO */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5053 /* Start up iconic or window? */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5054 x_wm_set_window_state
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5055 (f, (EQ (w32_get_arg (parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL), Qicon)
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5056 ? IconicState
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5057 : NormalState));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5058
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5059 x_text_icon (f, (char *) XSTRING ((!NILP (f->icon_name)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5060 ? f->icon_name
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5061 : f->name))->data);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5062 #endif
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5063
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5064 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5065 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5066
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5067
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5068 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5069 x_make_gc (f)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5070 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5071 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5072 XGCValues gc_values;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5073
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5074 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5075
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5076 /* Create the GC's of this frame.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5077 Note that many default values are used. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5078
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5079 /* Normal video */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5080 gc_values.font = f->output_data.w32->font;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5081
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5082 /* Cursor has cursor-color background, background-color foreground. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5083 gc_values.foreground = FRAME_BACKGROUND_PIXEL (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5084 gc_values.background = f->output_data.w32->cursor_pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5085 f->output_data.w32->cursor_gc
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5086 = XCreateGC (NULL, FRAME_W32_WINDOW (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5087 (GCFont | GCForeground | GCBackground),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5088 &gc_values);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5089
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5090 /* Reliefs. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5091 f->output_data.w32->white_relief.gc = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5092 f->output_data.w32->black_relief.gc = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5093
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5094 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5095 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5096
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5097
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5098 /* Handler for signals raised during x_create_frame and
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5099 x_create_top_frame. FRAME is the frame which is partially
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5100 constructed. */
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5101
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5102 static Lisp_Object
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5103 unwind_create_frame (frame)
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5104 Lisp_Object frame;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5105 {
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5106 struct frame *f = XFRAME (frame);
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5107
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5108 /* If frame is ``official'', nothing to do. */
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5109 if (!CONSP (Vframe_list) || !EQ (XCAR (Vframe_list), frame))
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5110 {
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5111 #ifdef GLYPH_DEBUG
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5112 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5113 #endif
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5114
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5115 x_free_frame_resources (f);
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5116
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5117 /* Check that reference counts are indeed correct. */
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5118 xassert (dpyinfo->reference_count == dpyinfo_refcount);
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5119 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: 34546
diff changeset
5120
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
5121 return Qt;
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5122 }
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5123
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5124 return Qnil;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5125 }
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5126
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5127
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5128 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5129 1, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5130 "Make a new window, which is called a \"frame\" in Emacs terms.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5131 Returns an Emacs frame object.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5132 ALIST is an alist of frame parameters.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5133 If the parameters specify that the frame should not have a minibuffer,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5134 and do not specify a specific minibuffer window to use,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5135 then `default-minibuffer-frame' must be a frame whose minibuffer can\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5136 be shared by the new frame.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5137 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5138 This function is an internal primitive--use `make-frame' instead.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5139 (parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5140 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5141 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5142 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5143 Lisp_Object frame, tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5144 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5145 int minibuffer_only = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5146 long window_prompting = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5147 int width, height;
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5148 int count = BINDING_STACK_SIZE ();
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5149 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5150 Lisp_Object display;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5151 struct w32_display_info *dpyinfo = NULL;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5152 Lisp_Object parent;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5153 struct kboard *kb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5154
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5155 check_w32 ();
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5156
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5157 /* Use this general default value to start with
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5158 until we know if this frame has a specified name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5159 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5160
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5161 display = w32_get_arg (parms, Qdisplay, 0, 0, RES_TYPE_STRING);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5162 if (EQ (display, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5163 display = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5164 dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5165 #ifdef MULTI_KBOARD
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5166 kb = dpyinfo->kboard;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5167 #else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5168 kb = &the_only_kboard;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5169 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5170
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5171 name = w32_get_arg (parms, Qname, "name", "Name", RES_TYPE_STRING);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5172 if (!STRINGP (name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5173 && ! EQ (name, Qunbound)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5174 && ! NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5175 error ("Invalid frame name--not a string or nil");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5176
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5177 if (STRINGP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5178 Vx_resource_name = name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5179
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5180 /* See if parent window is specified. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5181 parent = w32_get_arg (parms, Qparent_id, NULL, NULL, RES_TYPE_NUMBER);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5182 if (EQ (parent, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5183 parent = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5184 if (! NILP (parent))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5185 CHECK_NUMBER (parent, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5186
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5187 /* make_frame_without_minibuffer can run Lisp code and garbage collect. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5188 /* No need to protect DISPLAY because that's not used after passing
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5189 it to make_frame_without_minibuffer. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5190 frame = Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5191 GCPRO4 (parms, parent, name, frame);
32669
092d2df2a6c3 (Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents: 31110
diff changeset
5192 tem = w32_get_arg (parms, Qminibuffer, "minibuffer", "Minibuffer",
092d2df2a6c3 (Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents: 31110
diff changeset
5193 RES_TYPE_SYMBOL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5194 if (EQ (tem, Qnone) || NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5195 f = make_frame_without_minibuffer (Qnil, kb, display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5196 else if (EQ (tem, Qonly))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5197 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5198 f = make_minibuffer_frame ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5199 minibuffer_only = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5200 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5201 else if (WINDOWP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5202 f = make_frame_without_minibuffer (tem, kb, display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5203 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5204 f = make_frame (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5205
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5206 XSETFRAME (frame, f);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5207
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5208 /* Note that Windows does support scroll bars. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5209 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5210 /* By default, make scrollbars the system standard width. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5211 f->scroll_bar_pixel_width = GetSystemMetrics (SM_CXVSCROLL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5212
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5213 f->output_method = output_w32;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5214 f->output_data.w32 =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5215 (struct w32_output *) xmalloc (sizeof (struct w32_output));
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5216 bzero (f->output_data.w32, sizeof (struct w32_output));
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5217 FRAME_FONTSET (f) = -1;
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
5218 record_unwind_protect (unwind_create_frame, frame);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5219
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5220 f->icon_name
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5221 = w32_get_arg (parms, Qicon_name, "iconName", "Title", RES_TYPE_STRING);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5222 if (! STRINGP (f->icon_name))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5223 f->icon_name = Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5224
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5225 /* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5226 #ifdef MULTI_KBOARD
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5227 FRAME_KBOARD (f) = kb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5228 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5229
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5230 /* Specify the parent under which to make this window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5231
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5232 if (!NILP (parent))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5233 {
32669
092d2df2a6c3 (Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents: 31110
diff changeset
5234 f->output_data.w32->parent_desc = (Window) XFASTINT (parent);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5235 f->output_data.w32->explicit_parent = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5236 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5237 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5238 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5239 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5240 f->output_data.w32->explicit_parent = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5241 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5242
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5243 /* Set the name; the functions to which we pass f expect the name to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5244 be set. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5245 if (EQ (name, Qunbound) || NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5246 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5247 f->name = build_string (dpyinfo->w32_id_name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5248 f->explicit_name = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5249 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5250 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5251 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5252 f->name = name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5253 f->explicit_name = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5254 /* use the frame's title when getting resources for this frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5255 specbind (Qx_resource_name, name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5256 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5257
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5258 /* Extract the window parameters from the supplied values
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5259 that are needed to determine window geometry. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5260 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5261 Lisp_Object font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5262
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5263 font = w32_get_arg (parms, Qfont, "font", "Font", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5264
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5265 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5266 /* First, try whatever font the caller has specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5267 if (STRINGP (font))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5268 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5269 tem = Fquery_fontset (font, Qnil);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5270 if (STRINGP (tem))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5271 font = x_new_fontset (f, XSTRING (tem)->data);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5272 else
24481
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
5273 font = x_new_font (f, XSTRING (font)->data);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5274 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5275 /* Try out a font which we hope has bold and italic variations. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5276 if (!STRINGP (font))
32977
d0421102ed8c (Fx_create_frame): Make default fontsize on w32 10 point, as Windows
Jason Rumney <jasonr@gnu.org>
parents: 32791
diff changeset
5277 font = x_new_font (f, "-*-Courier New-normal-r-*-*-*-100-*-*-c-*-iso8859-1");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5278 if (! STRINGP (font))
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5279 font = x_new_font (f, "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5280 /* If those didn't work, look for something which will at least work. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5281 if (! STRINGP (font))
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5282 font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5283 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5284 if (! STRINGP (font))
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5285 font = build_string ("Fixedsys");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5286
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5287 x_default_parameter (f, parms, Qfont, font,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5288 "font", "Font", RES_TYPE_STRING);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5289 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5290
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5291 x_default_parameter (f, parms, Qborder_width, make_number (2),
32669
092d2df2a6c3 (Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents: 31110
diff changeset
5292 "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5293 /* This defaults to 2 in order to match xterm. We recognize either
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5294 internalBorderWidth or internalBorder (which is what xterm calls
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5295 it). */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5296 if (NILP (Fassq (Qinternal_border_width, parms)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5297 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5298 Lisp_Object value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5299
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5300 value = w32_get_arg (parms, Qinternal_border_width,
32669
092d2df2a6c3 (Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents: 31110
diff changeset
5301 "internalBorder", "InternalBorder", RES_TYPE_NUMBER);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5302 if (! EQ (value, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5303 parms = Fcons (Fcons (Qinternal_border_width, value),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5304 parms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5305 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5306 /* Default internalBorderWidth to 0 on Windows to match other programs. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5307 x_default_parameter (f, parms, Qinternal_border_width, make_number (0),
32669
092d2df2a6c3 (Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents: 31110
diff changeset
5308 "internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER);
092d2df2a6c3 (Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents: 31110
diff changeset
5309 x_default_parameter (f, parms, Qvertical_scroll_bars, Qright,
092d2df2a6c3 (Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents: 31110
diff changeset
5310 "verticalScrollBars", "ScrollBars", RES_TYPE_SYMBOL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5311
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5312 /* Also do the stuff which must be set before the window exists. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5313 x_default_parameter (f, parms, Qforeground_color, build_string ("black"),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5314 "foreground", "Foreground", RES_TYPE_STRING);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5315 x_default_parameter (f, parms, Qbackground_color, build_string ("white"),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5316 "background", "Background", RES_TYPE_STRING);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5317 x_default_parameter (f, parms, Qmouse_color, build_string ("black"),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5318 "pointerColor", "Foreground", RES_TYPE_STRING);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5319 x_default_parameter (f, parms, Qcursor_color, build_string ("black"),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5320 "cursorColor", "Foreground", RES_TYPE_STRING);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5321 x_default_parameter (f, parms, Qborder_color, build_string ("black"),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5322 "borderColor", "BorderColor", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5323 x_default_parameter (f, parms, Qscreen_gamma, Qnil,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5324 "screenGamma", "ScreenGamma", RES_TYPE_FLOAT);
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5325 x_default_parameter (f, parms, Qline_spacing, Qnil,
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5326 "lineSpacing", "LineSpacing", RES_TYPE_NUMBER);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5327
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5328
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5329 /* Init faces before x_default_parameter is called for scroll-bar
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5330 parameters because that function calls x_set_scroll_bar_width,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5331 which calls change_frame_size, which calls Fset_window_buffer,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5332 which runs hooks, which call Fvertical_motion. At the end, we
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5333 end up in init_iterator with a null face cache, which should not
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5334 happen. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5335 init_frame_faces (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5336
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5337 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5338 "menuBar", "MenuBar", RES_TYPE_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5339 x_default_parameter (f, parms, Qtool_bar_lines, make_number (0),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5340 "toolBar", "ToolBar", RES_TYPE_NUMBER);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5341 x_default_parameter (f, parms, Qbuffer_predicate, Qnil,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5342 "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5343 x_default_parameter (f, parms, Qtitle, Qnil,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5344 "title", "Title", RES_TYPE_STRING);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5345
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5346 f->output_data.w32->dwStyle = WS_OVERLAPPEDWINDOW;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5347 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5348 window_prompting = x_figure_window_size (f, parms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5349
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5350 if (window_prompting & XNegative)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5351 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5352 if (window_prompting & YNegative)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5353 f->output_data.w32->win_gravity = SouthEastGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5354 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5355 f->output_data.w32->win_gravity = NorthEastGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5356 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5357 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5358 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5359 if (window_prompting & YNegative)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5360 f->output_data.w32->win_gravity = SouthWestGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5361 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5362 f->output_data.w32->win_gravity = NorthWestGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5363 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5364
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5365 f->output_data.w32->size_hint_flags = window_prompting;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5366
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5367 tem = w32_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5368 f->no_split = minibuffer_only || EQ (tem, Qt);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5369
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5370 /* Create the window. Add the tool-bar height to the initial frame
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5371 height so that the user gets a text display area of the size he
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5372 specified with -g or via the registry. Later changes of the
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5373 tool-bar height don't change the frame size. This is done so that
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5374 users can create tall Emacs frames without having to guess how
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5375 tall the tool-bar will get. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5376 f->height += FRAME_TOOL_BAR_LINES (f);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5377 w32_window (f, window_prompting, minibuffer_only);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5378 x_icon (f, parms);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5379
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5380 x_make_gc (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5381
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5382 /* Now consider the frame official. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5383 FRAME_W32_DISPLAY_INFO (f)->reference_count++;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5384 Vframe_list = Fcons (frame, Vframe_list);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5385
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5386 /* We need to do this after creating the window, so that the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5387 icon-creation functions can say whose icon they're describing. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5388 x_default_parameter (f, parms, Qicon_type, Qnil,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5389 "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5390
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5391 x_default_parameter (f, parms, Qauto_raise, Qnil,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5392 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5393 x_default_parameter (f, parms, Qauto_lower, Qnil,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5394 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5395 x_default_parameter (f, parms, Qcursor_type, Qbox,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5396 "cursorType", "CursorType", RES_TYPE_SYMBOL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5397 x_default_parameter (f, parms, Qscroll_bar_width, Qnil,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5398 "scrollBarWidth", "ScrollBarWidth", RES_TYPE_NUMBER);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5399
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5400 /* Dimensions, especially f->height, must be done via change_frame_size.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5401 Change will not be effected unless different from the current
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5402 f->height. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5403 width = f->width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5404 height = f->height;
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5405
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5406 /* Add the tool-bar height to the initial frame height so that the
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5407 user gets a text display area of the size he specified with -g or
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5408 via .Xdefaults. Later changes of the tool-bar height don't
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5409 change the frame size. This is done so that users can create
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5410 tall Emacs frames without having to guess how tall the tool-bar
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5411 will get. */
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5412 if (FRAME_TOOL_BAR_LINES (f))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5413 {
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5414 int margin, relief, bar_height;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5415
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5416 relief = (tool_bar_button_relief > 0
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5417 ? tool_bar_button_relief
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5418 : DEFAULT_TOOL_BAR_BUTTON_RELIEF);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5419
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5420 if (INTEGERP (Vtool_bar_button_margin)
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5421 && XINT (Vtool_bar_button_margin) > 0)
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5422 margin = XFASTINT (Vtool_bar_button_margin);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5423 else if (CONSP (Vtool_bar_button_margin)
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5424 && INTEGERP (XCDR (Vtool_bar_button_margin))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5425 && XINT (XCDR (Vtool_bar_button_margin)) > 0)
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5426 margin = XFASTINT (XCDR (Vtool_bar_button_margin));
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5427 else
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5428 margin = 0;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5429
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5430 bar_height = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5431 height += (bar_height + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5432 }
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
5433
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
5434 f->height = 0;
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
5435 SET_FRAME_WIDTH (f, 0);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5436 change_frame_size (f, height, width, 1, 0, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5437
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5438 /* Tell the server what size and position, etc, we want, and how
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5439 badly we want them. This should be done after we have the menu
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5440 bar so that its size can be taken into account. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5441 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5442 x_wm_set_size_hint (f, window_prompting, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5443 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5444
34133
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
5445 /* Set up faces after all frame parameters are known. This call
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
5446 also merges in face attributes specified for new frames. If we
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
5447 don't do this, the `menu' face for instance won't have the right
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
5448 colors, and the menu bar won't appear in the specified colors for
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
5449 new frames. */
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
5450 call1 (Qface_set_after_frame_default, frame);
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
5451
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5452 /* Make the window appear on the frame and enable display, unless
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5453 the caller says not to. However, with explicit parent, Emacs
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5454 cannot control visibility, so don't try. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5455 if (! f->output_data.w32->explicit_parent)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5456 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5457 Lisp_Object visibility;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5458
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5459 visibility = w32_get_arg (parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5460 if (EQ (visibility, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5461 visibility = Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5462
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5463 if (EQ (visibility, Qicon))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5464 x_iconify_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5465 else if (! NILP (visibility))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5466 x_make_frame_visible (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5467 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5468 /* Must have been Qnil. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5469 ;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5470 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5471 UNGCPRO;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5472 return unbind_to (count, frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5473 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5474
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5475 /* FRAME is used only to get a handle on the X display. We don't pass the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5476 display info directly because we're called from frame.c, which doesn't
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5477 know about that structure. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5478 Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5479 x_get_focus_frame (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5480 struct frame *frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5481 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5482 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5483 Lisp_Object xfocus;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5484 if (! dpyinfo->w32_focus_frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5485 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5486
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5487 XSETFRAME (xfocus, dpyinfo->w32_focus_frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5488 return xfocus;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5489 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5490
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5491 DEFUN ("w32-focus-frame", Fw32_focus_frame, Sw32_focus_frame, 1, 1, 0,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5492 "Give FRAME input focus, raising to foreground if necessary.")
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5493 (frame)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5494 Lisp_Object frame;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5495 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5496 x_focus_on_frame (check_x_frame (frame));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5497 return Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5498 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5499
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5500
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5501 /* Return the charset portion of a font name. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5502 char * xlfd_charset_of_font (char * fontname)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5503 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5504 char *charset, *encoding;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5505
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5506 encoding = strrchr(fontname, '-');
34284
3a21ff35392b (xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents: 34133
diff changeset
5507 if (!encoding || encoding == fontname)
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5508 return NULL;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5509
34314
8318a4ea6764 (xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents: 34284
diff changeset
5510 for (charset = encoding - 1; charset >= fontname; charset--)
8318a4ea6764 (xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents: 34284
diff changeset
5511 if (*charset == '-')
8318a4ea6764 (xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents: 34284
diff changeset
5512 break;
8318a4ea6764 (xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents: 34284
diff changeset
5513
8318a4ea6764 (xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents: 34284
diff changeset
5514 if (charset == fontname || strcmp(charset, "-*-*") == 0)
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5515 return NULL;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5516
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5517 return charset + 1;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5518 }
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5519
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5520 struct font_info *w32_load_bdf_font (struct frame *f, char *fontname,
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5521 int size, char* filename);
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
5522 static Lisp_Object w32_list_bdf_fonts (Lisp_Object pattern, int max_names);
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5523 BOOL w32_to_x_font (LOGFONT * lplf, char * lpxstr, int len, char * charset);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5524
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
5525 static struct font_info *
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5526 w32_load_system_font (f,fontname,size)
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5527 struct frame *f;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5528 char * fontname;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5529 int size;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5530 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5531 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5532 Lisp_Object font_names;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5533
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5534 /* Get a list of all the fonts that match this name. Once we
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5535 have a list of matching fonts, we compare them against the fonts
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5536 we already have loaded by comparing names. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5537 font_names = w32_list_fonts (f, build_string (fontname), size, 100);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5538
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5539 if (!NILP (font_names))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5540 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5541 Lisp_Object tail;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5542 int i;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5543
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5544 /* First check if any are already loaded, as that is cheaper
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5545 than loading another one. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5546 for (i = 0; i < dpyinfo->n_fonts; i++)
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
5547 for (tail = font_names; CONSP (tail); tail = XCDR (tail))
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5548 if (dpyinfo->font_table[i].name
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5549 && (!strcmp (dpyinfo->font_table[i].name,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5550 XSTRING (XCAR (tail))->data)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5551 || !strcmp (dpyinfo->font_table[i].full_name,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5552 XSTRING (XCAR (tail))->data)))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5553 return (dpyinfo->font_table + i);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5554
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
5555 fontname = (char *) XSTRING (XCAR (font_names))->data;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5556 }
24481
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
5557 else if (w32_strict_fontnames)
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5558 {
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5559 /* If EnumFontFamiliesEx was available, we got a full list of
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5560 fonts back so stop now to avoid the possibility of loading a
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5561 random font. If we had to fall back to EnumFontFamilies, the
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5562 list is incomplete, so continue whether the font we want was
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5563 listed or not. */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5564 HMODULE gdi32 = GetModuleHandle ("gdi32.dll");
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5565 FARPROC enum_font_families_ex
24481
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
5566 = GetProcAddress (gdi32, "EnumFontFamiliesExA");
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5567 if (enum_font_families_ex)
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5568 return NULL;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5569 }
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5570
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5571 /* Load the font and add it to the table. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5572 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5573 char *full_name, *encoding, *charset;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5574 XFontStruct *font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5575 struct font_info *fontp;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5576 LOGFONT lf;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5577 BOOL ok;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5578 int i;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5579
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5580 if (!fontname || !x_to_w32_font (fontname, &lf))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5581 return (NULL);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5582
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5583 if (!*lf.lfFaceName)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5584 /* If no name was specified for the font, we get a random font
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5585 from CreateFontIndirect - this is not particularly
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5586 desirable, especially since CreateFontIndirect does not
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5587 fill out the missing name in lf, so we never know what we
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5588 ended up with. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5589 return NULL;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5590
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5591 font = (XFontStruct *) xmalloc (sizeof (XFontStruct));
32721
0574ffc14f77 (w32_load_system_font): Call w32_cache_char_metrics.
Andrew Innes <andrewi@gnu.org>
parents: 32669
diff changeset
5592 bzero (font, sizeof (*font));
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5593
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5594 /* Set bdf to NULL to indicate that this is a Windows font. */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5595 font->bdf = NULL;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5596
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5597 BLOCK_INPUT;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5598
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5599 font->hfont = CreateFontIndirect (&lf);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5600
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5601 if (font->hfont == NULL)
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5602 {
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5603 ok = FALSE;
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5604 }
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5605 else
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5606 {
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5607 HDC hdc;
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5608 HANDLE oldobj;
33929
886f1ee076bd (w32_load_system_font): Always mark font as double byte if codepage is unicode.
Jason Rumney <jasonr@gnu.org>
parents: 33879
diff changeset
5609 int codepage = w32_codepage_for_font (fontname);
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5610
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5611 hdc = GetDC (dpyinfo->root_window);
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5612 oldobj = SelectObject (hdc, font->hfont);
33929
886f1ee076bd (w32_load_system_font): Always mark font as double byte if codepage is unicode.
Jason Rumney <jasonr@gnu.org>
parents: 33879
diff changeset
5613
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5614 ok = GetTextMetrics (hdc, &font->tm);
33929
886f1ee076bd (w32_load_system_font): Always mark font as double byte if codepage is unicode.
Jason Rumney <jasonr@gnu.org>
parents: 33879
diff changeset
5615 if (codepage == CP_UNICODE)
886f1ee076bd (w32_load_system_font): Always mark font as double byte if codepage is unicode.
Jason Rumney <jasonr@gnu.org>
parents: 33879
diff changeset
5616 font->double_byte_p = 1;
886f1ee076bd (w32_load_system_font): Always mark font as double byte if codepage is unicode.
Jason Rumney <jasonr@gnu.org>
parents: 33879
diff changeset
5617 else
886f1ee076bd (w32_load_system_font): Always mark font as double byte if codepage is unicode.
Jason Rumney <jasonr@gnu.org>
parents: 33879
diff changeset
5618 font->double_byte_p = GetFontLanguageInfo(hdc) & GCP_DBCS;
886f1ee076bd (w32_load_system_font): Always mark font as double byte if codepage is unicode.
Jason Rumney <jasonr@gnu.org>
parents: 33879
diff changeset
5619
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5620 SelectObject (hdc, oldobj);
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5621 ReleaseDC (dpyinfo->root_window, hdc);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5622 /* Fill out details in lf according to the font that was
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5623 actually loaded. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5624 lf.lfHeight = font->tm.tmInternalLeading - font->tm.tmHeight;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5625 lf.lfWidth = font->tm.tmAveCharWidth;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5626 lf.lfWeight = font->tm.tmWeight;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5627 lf.lfItalic = font->tm.tmItalic;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5628 lf.lfCharSet = font->tm.tmCharSet;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5629 lf.lfPitchAndFamily = ((font->tm.tmPitchAndFamily & TMPF_FIXED_PITCH)
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5630 ? VARIABLE_PITCH : FIXED_PITCH);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5631 lf.lfOutPrecision = ((font->tm.tmPitchAndFamily & TMPF_VECTOR)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5632 ? OUT_STROKE_PRECIS : OUT_STRING_PRECIS);
32721
0574ffc14f77 (w32_load_system_font): Call w32_cache_char_metrics.
Andrew Innes <andrewi@gnu.org>
parents: 32669
diff changeset
5633
0574ffc14f77 (w32_load_system_font): Call w32_cache_char_metrics.
Andrew Innes <andrewi@gnu.org>
parents: 32669
diff changeset
5634 w32_cache_char_metrics (font);
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5635 }
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5636
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5637 UNBLOCK_INPUT;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5638
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5639 if (!ok)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5640 {
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5641 w32_unload_font (dpyinfo, font);
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5642 return (NULL);
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5643 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5644
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5645 /* Find a free slot in the font table. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5646 for (i = 0; i < dpyinfo->n_fonts; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5647 if (dpyinfo->font_table[i].name == NULL)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5648 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5649
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5650 /* If no free slot found, maybe enlarge the font table. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5651 if (i == dpyinfo->n_fonts
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5652 && dpyinfo->n_fonts == dpyinfo->font_table_size)
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5653 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5654 int sz;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5655 dpyinfo->font_table_size = max (16, 2 * dpyinfo->font_table_size);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5656 sz = dpyinfo->font_table_size * sizeof *dpyinfo->font_table;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5657 dpyinfo->font_table
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5658 = (struct font_info *) xrealloc (dpyinfo->font_table, sz);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5659 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5660
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5661 fontp = dpyinfo->font_table + i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5662 if (i == dpyinfo->n_fonts)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5663 ++dpyinfo->n_fonts;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5664
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5665 /* Now fill in the slots of *FONTP. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5666 BLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5667 fontp->font = font;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5668 fontp->font_idx = i;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5669 fontp->name = (char *) xmalloc (strlen (fontname) + 1);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5670 bcopy (fontname, fontp->name, strlen (fontname) + 1);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5671
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5672 charset = xlfd_charset_of_font (fontname);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5673
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5674 /* Work out the font's full name. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5675 full_name = (char *)xmalloc (100);
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5676 if (full_name && w32_to_x_font (&lf, full_name, 100, charset))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5677 fontp->full_name = full_name;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5678 else
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5679 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5680 /* If all else fails - just use the name we used to load it. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5681 xfree (full_name);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5682 fontp->full_name = fontp->name;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5683 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5684
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5685 fontp->size = FONT_WIDTH (font);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5686 fontp->height = FONT_HEIGHT (font);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5687
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5688 /* The slot `encoding' specifies how to map a character
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5689 code-points (0x20..0x7F or 0x2020..0x7F7F) of each charset to
28272
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
5690 the font code-points (0:0x20..0x7F, 1:0xA0..0xFF), or
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
5691 (0:0x20..0x7F, 1:0xA0..0xFF,
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
5692 (0:0x2020..0x7F7F, 1:0xA0A0..0xFFFF, 3:0x20A0..0x7FFF,
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5693 2:0xA020..0xFF7F). For the moment, we don't know which charset
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5694 uses this font. So, we set information in fontp->encoding[1]
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5695 which is never used by any charset. If mapping can't be
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5696 decided, set FONT_ENCODING_NOT_DECIDED. */
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5697
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5698 /* SJIS fonts need to be set to type 4, all others seem to work as
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5699 type FONT_ENCODING_NOT_DECIDED. */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5700 encoding = strrchr (fontp->name, '-');
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5701 if (encoding && stricmp (encoding+1, "sjis") == 0)
24692
a0a2521b783d (x_to_w32_charset): Fix typo: want to map all Japanese
Andrew Innes <andrewi@gnu.org>
parents: 24679
diff changeset
5702 fontp->encoding[1] = 4;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5703 else
24692
a0a2521b783d (x_to_w32_charset): Fix typo: want to map all Japanese
Andrew Innes <andrewi@gnu.org>
parents: 24679
diff changeset
5704 fontp->encoding[1] = FONT_ENCODING_NOT_DECIDED;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5705
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5706 /* The following three values are set to 0 under W32, which is
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5707 what they get set to if XGetFontProperty fails under X. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5708 fontp->baseline_offset = 0;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5709 fontp->relative_compose = 0;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5710 fontp->default_ascent = 0;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5711
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5712 /* Set global flag fonts_changed_p to non-zero if the font loaded
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5713 has a character with a smaller width than any other character
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5714 before, or if the font loaded has a smalle>r height than any
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5715 other font loaded before. If this happens, it will make a
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5716 glyph matrix reallocation necessary. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5717 fonts_changed_p = x_compute_min_glyph_bounds (f);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5718 UNBLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5719 return fontp;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5720 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5721 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5722
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5723 /* Load font named FONTNAME of size SIZE for frame F, and return a
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5724 pointer to the structure font_info while allocating it dynamically.
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5725 If loading fails, return NULL. */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5726 struct font_info *
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5727 w32_load_font (f,fontname,size)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5728 struct frame *f;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5729 char * fontname;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5730 int size;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5731 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5732 Lisp_Object bdf_fonts;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5733 struct font_info *retval = NULL;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5734
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
5735 bdf_fonts = w32_list_bdf_fonts (build_string (fontname), 1);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5736
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5737 while (!retval && CONSP (bdf_fonts))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5738 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5739 char *bdf_name, *bdf_file;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5740 Lisp_Object bdf_pair;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5741
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
5742 bdf_name = XSTRING (XCAR (bdf_fonts))->data;
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
5743 bdf_pair = Fassoc (XCAR (bdf_fonts), Vw32_bdf_filename_alist);
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
5744 bdf_file = XSTRING (XCDR (bdf_pair))->data;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5745
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5746 retval = w32_load_bdf_font (f, bdf_name, size, bdf_file);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5747
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
5748 bdf_fonts = XCDR (bdf_fonts);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5749 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5750
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5751 if (retval)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5752 return retval;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5753
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5754 return w32_load_system_font(f, fontname, size);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5755 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5756
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5757
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5758 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5759 w32_unload_font (dpyinfo, font)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5760 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5761 XFontStruct * font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5762 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5763 if (font)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5764 {
32721
0574ffc14f77 (w32_load_system_font): Call w32_cache_char_metrics.
Andrew Innes <andrewi@gnu.org>
parents: 32669
diff changeset
5765 if (font->per_char) xfree (font->per_char);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5766 if (font->bdf) w32_free_bdf_font (font->bdf);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5767
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5768 if (font->hfont) DeleteObject(font->hfont);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5769 xfree (font);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5770 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5771 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5772
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5773 /* The font conversion stuff between x and w32 */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5774
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5775 /* X font string is as follows (from faces.el)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5776 * (let ((- "[-?]")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5777 * (foundry "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5778 * (family "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5779 * (weight "\\(bold\\|demibold\\|medium\\)") ; 1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5780 * (weight\? "\\([^-]*\\)") ; 1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5781 * (slant "\\([ior]\\)") ; 2
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5782 * (slant\? "\\([^-]?\\)") ; 2
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5783 * (swidth "\\([^-]*\\)") ; 3
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5784 * (adstyle "[^-]*") ; 4
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5785 * (pixelsize "[0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5786 * (pointsize "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5787 * (resx "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5788 * (resy "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5789 * (spacing "[cmp?*]")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5790 * (avgwidth "[0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5791 * (registry "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5792 * (encoding "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5793 * )
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5794 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5795
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
5796 static LONG
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5797 x_to_w32_weight (lpw)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5798 char * lpw;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5799 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5800 if (!lpw) return (FW_DONTCARE);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5801
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5802 if (stricmp (lpw,"heavy") == 0) return FW_HEAVY;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5803 else if (stricmp (lpw,"extrabold") == 0) return FW_EXTRABOLD;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5804 else if (stricmp (lpw,"bold") == 0) return FW_BOLD;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5805 else if (stricmp (lpw,"demibold") == 0) return FW_SEMIBOLD;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5806 else if (stricmp (lpw,"semibold") == 0) return FW_SEMIBOLD;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5807 else if (stricmp (lpw,"medium") == 0) return FW_MEDIUM;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5808 else if (stricmp (lpw,"normal") == 0) return FW_NORMAL;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5809 else if (stricmp (lpw,"light") == 0) return FW_LIGHT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5810 else if (stricmp (lpw,"extralight") == 0) return FW_EXTRALIGHT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5811 else if (stricmp (lpw,"thin") == 0) return FW_THIN;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5812 else
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5813 return FW_DONTCARE;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5814 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5815
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5816
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
5817 static char *
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5818 w32_to_x_weight (fnweight)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5819 int fnweight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5820 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5821 if (fnweight >= FW_HEAVY) return "heavy";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5822 if (fnweight >= FW_EXTRABOLD) return "extrabold";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5823 if (fnweight >= FW_BOLD) return "bold";
24856
07a04c532706 (w32_to_x_weight): Return "demibold" instead of "semibold".
Andrew Innes <andrewi@gnu.org>
parents: 24751
diff changeset
5824 if (fnweight >= FW_SEMIBOLD) return "demibold";
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5825 if (fnweight >= FW_MEDIUM) return "medium";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5826 if (fnweight >= FW_NORMAL) return "normal";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5827 if (fnweight >= FW_LIGHT) return "light";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5828 if (fnweight >= FW_EXTRALIGHT) return "extralight";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5829 if (fnweight >= FW_THIN) return "thin";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5830 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5831 return "*";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5832 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5833
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
5834 static LONG
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5835 x_to_w32_charset (lpcs)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5836 char * lpcs;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5837 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5838 Lisp_Object this_entry, w32_charset;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5839
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5840 /* Look through w32-charset-info-alist for the character set.
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5841 Format of each entry is
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5842 (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)).
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5843 */
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5844 this_entry = Fassoc (build_string(lpcs), Vw32_charset_info_alist);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5845
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5846 if (NILP(this_entry))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5847 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5848 /* At startup, we want iso8859-1 fonts to come up properly. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5849 if (stricmp(lpcs, "iso8859-1") == 0)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5850 return ANSI_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5851 else
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5852 return DEFAULT_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5853 }
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5854
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5855 w32_charset = Fcar (Fcdr (this_entry));
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5856
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5857 // Translate Lisp symbol to number.
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5858 if (w32_charset == Qw32_charset_ansi)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5859 return ANSI_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5860 if (w32_charset == Qw32_charset_symbol)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5861 return SYMBOL_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5862 if (w32_charset == Qw32_charset_shiftjis)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5863 return SHIFTJIS_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5864 if (w32_charset == Qw32_charset_hangeul)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5865 return HANGEUL_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5866 if (w32_charset == Qw32_charset_chinesebig5)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5867 return CHINESEBIG5_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5868 if (w32_charset == Qw32_charset_gb2312)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5869 return GB2312_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5870 if (w32_charset == Qw32_charset_oem)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5871 return OEM_CHARSET;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5872 #ifdef JOHAB_CHARSET
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5873 if (w32_charset == Qw32_charset_johab)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5874 return JOHAB_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5875 if (w32_charset == Qw32_charset_easteurope)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5876 return EASTEUROPE_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5877 if (w32_charset == Qw32_charset_turkish)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5878 return TURKISH_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5879 if (w32_charset == Qw32_charset_baltic)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5880 return BALTIC_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5881 if (w32_charset == Qw32_charset_russian)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5882 return RUSSIAN_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5883 if (w32_charset == Qw32_charset_arabic)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5884 return ARABIC_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5885 if (w32_charset == Qw32_charset_greek)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5886 return GREEK_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5887 if (w32_charset == Qw32_charset_hebrew)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5888 return HEBREW_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5889 if (w32_charset == Qw32_charset_vietnamese)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5890 return VIETNAMESE_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5891 if (w32_charset == Qw32_charset_thai)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5892 return THAI_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5893 if (w32_charset == Qw32_charset_mac)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5894 return MAC_CHARSET;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5895 #endif /* JOHAB_CHARSET */
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5896 #ifdef UNICODE_CHARSET
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5897 if (w32_charset == Qw32_charset_unicode)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5898 return UNICODE_CHARSET;
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5899 #endif
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5900
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5901 return DEFAULT_CHARSET;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5902 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5903
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5904
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
5905 static char *
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5906 w32_to_x_charset (fncharset)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5907 int fncharset;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5908 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5909 static char buf[16];
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5910 Lisp_Object charset_type;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5911
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5912 switch (fncharset)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5913 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5914 case ANSI_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5915 /* Handle startup case of w32-charset-info-alist not
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5916 being set up yet. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5917 if (NILP(Vw32_charset_info_alist))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5918 return "iso8859-1";
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5919 charset_type = Qw32_charset_ansi;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5920 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5921 case DEFAULT_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5922 charset_type = Qw32_charset_default;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5923 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5924 case SYMBOL_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5925 charset_type = Qw32_charset_symbol;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5926 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5927 case SHIFTJIS_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5928 charset_type = Qw32_charset_shiftjis;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5929 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5930 case HANGEUL_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5931 charset_type = Qw32_charset_hangeul;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5932 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5933 case GB2312_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5934 charset_type = Qw32_charset_gb2312;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5935 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5936 case CHINESEBIG5_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5937 charset_type = Qw32_charset_chinesebig5;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5938 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5939 case OEM_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5940 charset_type = Qw32_charset_oem;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5941 break;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5942
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5943 /* More recent versions of Windows (95 and NT4.0) define more
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5944 character sets. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5945 #ifdef EASTEUROPE_CHARSET
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5946 case EASTEUROPE_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5947 charset_type = Qw32_charset_easteurope;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5948 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5949 case TURKISH_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5950 charset_type = Qw32_charset_turkish;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5951 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5952 case BALTIC_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5953 charset_type = Qw32_charset_baltic;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5954 break;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5955 case RUSSIAN_CHARSET:
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5956 charset_type = Qw32_charset_russian;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5957 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5958 case ARABIC_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5959 charset_type = Qw32_charset_arabic;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5960 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5961 case GREEK_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5962 charset_type = Qw32_charset_greek;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5963 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5964 case HEBREW_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5965 charset_type = Qw32_charset_hebrew;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5966 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5967 case VIETNAMESE_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5968 charset_type = Qw32_charset_vietnamese;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5969 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5970 case THAI_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5971 charset_type = Qw32_charset_thai;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5972 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5973 case MAC_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5974 charset_type = Qw32_charset_mac;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5975 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5976 case JOHAB_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5977 charset_type = Qw32_charset_johab;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5978 break;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5979 #endif
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5980
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5981 #ifdef UNICODE_CHARSET
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5982 case UNICODE_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5983 charset_type = Qw32_charset_unicode;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5984 break;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5985 #endif
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5986 default:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5987 /* Encode numerical value of unknown charset. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5988 sprintf (buf, "*-#%u", fncharset);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5989 return buf;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5990 }
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5991
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5992 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5993 Lisp_Object rest;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5994 char * best_match = NULL;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5995
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5996 /* Look through w32-charset-info-alist for the character set.
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5997 Prefer ISO codepages, and prefer lower numbers in the ISO
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5998 range. Only return charsets for codepages which are installed.
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5999
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6000 Format of each entry is
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6001 (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)).
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6002 */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6003 for (rest = Vw32_charset_info_alist; CONSP (rest); rest = XCDR (rest))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6004 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6005 char * x_charset;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6006 Lisp_Object w32_charset;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6007 Lisp_Object codepage;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6008
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6009 Lisp_Object this_entry = XCAR (rest);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6010
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6011 /* Skip invalid entries in alist. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6012 if (!CONSP (this_entry) || !STRINGP (XCAR (this_entry))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6013 || !CONSP (XCDR (this_entry))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6014 || !SYMBOLP (XCAR (XCDR (this_entry))))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6015 continue;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6016
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6017 x_charset = XSTRING (XCAR (this_entry))->data;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6018 w32_charset = XCAR (XCDR (this_entry));
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6019 codepage = XCDR (XCDR (this_entry));
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6020
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6021 /* Look for Same charset and a valid codepage (or non-int
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6022 which means ignore). */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6023 if (w32_charset == charset_type
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6024 && (!INTEGERP (codepage) || codepage == CP_DEFAULT
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6025 || IsValidCodePage (XINT (codepage))))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6026 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6027 /* If we don't have a match already, then this is the
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6028 best. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6029 if (!best_match)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6030 best_match = x_charset;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6031 /* If this is an ISO codepage, and the best so far isn't,
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6032 then this is better. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6033 else if (stricmp (best_match, "iso") != 0
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6034 && stricmp (x_charset, "iso") == 0)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6035 best_match = x_charset;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6036 /* If both are ISO8859 codepages, choose the one with the
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6037 lowest number in the encoding field. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6038 else if (stricmp (best_match, "iso8859-") == 0
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6039 && stricmp (x_charset, "iso8859-") == 0)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6040 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6041 int best_enc = atoi (best_match + 8);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6042 int this_enc = atoi (x_charset + 8);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6043 if (this_enc > 0 && this_enc < best_enc)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6044 best_match = x_charset;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6045 }
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6046 }
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6047 }
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6048
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6049 /* If no match, encode the numeric value. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6050 if (!best_match)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6051 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6052 sprintf (buf, "*-#%u", fncharset);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6053 return buf;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6054 }
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6055
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6056 strncpy(buf, best_match, 15);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6057 buf[15] = '\0';
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6058 return buf;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6059 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6060 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6061
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6062
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6063 /* Get the Windows codepage corresponding to the specified font. The
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6064 charset info in the font name is used to look up
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6065 w32-charset-to-codepage-alist. */
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6066 int
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6067 w32_codepage_for_font (char *fontname)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6068 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6069 Lisp_Object codepage, entry;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6070 char *charset_str, *charset, *end;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6071
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6072 if (NILP (Vw32_charset_info_alist))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6073 return CP_DEFAULT;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6074
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6075 /* Extract charset part of font string. */
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6076 charset = xlfd_charset_of_font (fontname);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6077
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6078 if (!charset)
34284
3a21ff35392b (xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents: 34133
diff changeset
6079 return CP_UNKNOWN;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6080
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6081 charset_str = (char *) alloca (strlen (charset));
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6082 strcpy (charset_str, charset);
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6083
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6084 /* Remove leading "*-". */
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6085 if (strncmp ("*-", charset_str, 2) == 0)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6086 charset = charset_str + 2;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6087 else
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6088 charset = charset_str;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6089
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6090 /* Stop match at wildcard (including preceding '-'). */
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6091 if (end = strchr (charset, '*'))
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6092 {
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6093 if (end > charset && *(end-1) == '-')
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6094 end--;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6095 *end = '\0';
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6096 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6097
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6098 entry = Fassoc (build_string(charset), Vw32_charset_info_alist);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6099 if (NILP (entry))
34284
3a21ff35392b (xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents: 34133
diff changeset
6100 return CP_UNKNOWN;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6101
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6102 codepage = Fcdr (Fcdr (entry));
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6103
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6104 if (NILP (codepage))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6105 return CP_8BIT;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6106 else if (XFASTINT (codepage) == XFASTINT (Qt))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6107 return CP_UNICODE;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6108 else if (INTEGERP (codepage))
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6109 return XINT (codepage);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6110 else
34284
3a21ff35392b (xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents: 34133
diff changeset
6111 return CP_UNKNOWN;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6112 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6113
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6114
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6115 static BOOL
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6116 w32_to_x_font (lplogfont, lpxstr, len, specific_charset)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6117 LOGFONT * lplogfont;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6118 char * lpxstr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6119 int len;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6120 char * specific_charset;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6121 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6122 char* fonttype;
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6123 char *fontname;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6124 char height_pixels[8];
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6125 char height_dpi[8];
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6126 char width_pixels[8];
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6127 char *fontname_dash;
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6128 int display_resy = one_w32_display_info.resy;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6129 int display_resx = one_w32_display_info.resx;
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6130 int bufsz;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6131 struct coding_system coding;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6132
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6133 if (!lpxstr) abort ();
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6134
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6135 if (!lplogfont)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6136 return FALSE;
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6137
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6138 if (lplogfont->lfOutPrecision == OUT_STRING_PRECIS)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6139 fonttype = "raster";
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6140 else if (lplogfont->lfOutPrecision == OUT_STROKE_PRECIS)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6141 fonttype = "outline";
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6142 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6143 fonttype = "unknown";
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6144
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6145 setup_coding_system (Fcheck_coding_system (Vw32_system_coding_system),
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6146 &coding);
29021
be2769eac1a5 (w32_to_x_font): Setup members src_multibyte and
Kenichi Handa <handa@m17n.org>
parents: 28983
diff changeset
6147 coding.src_multibyte = 0;
be2769eac1a5 (w32_to_x_font): Setup members src_multibyte and
Kenichi Handa <handa@m17n.org>
parents: 28983
diff changeset
6148 coding.dst_multibyte = 1;
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6149 coding.mode |= CODING_MODE_LAST_BLOCK;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6150 bufsz = decoding_buffer_size (&coding, LF_FACESIZE);
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6151
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6152 fontname = alloca(sizeof(*fontname) * bufsz);
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6153 decode_coding (&coding, lplogfont->lfFaceName, fontname,
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6154 strlen(lplogfont->lfFaceName), bufsz - 1);
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6155 *(fontname + coding.produced) = '\0';
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6156
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6157 /* Replace dashes with underscores so the dashes are not
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6158 misinterpreted. */
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6159 fontname_dash = fontname;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6160 while (fontname_dash = strchr (fontname_dash, '-'))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6161 *fontname_dash = '_';
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6162
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6163 if (lplogfont->lfHeight)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6164 {
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6165 sprintf (height_pixels, "%u", abs (lplogfont->lfHeight));
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6166 sprintf (height_dpi, "%u",
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6167 abs (lplogfont->lfHeight) * 720 / display_resy);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6168 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6169 else
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6170 {
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6171 strcpy (height_pixels, "*");
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6172 strcpy (height_dpi, "*");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6173 }
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6174 if (lplogfont->lfWidth)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6175 sprintf (width_pixels, "%u", lplogfont->lfWidth * 10);
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6176 else
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6177 strcpy (width_pixels, "*");
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6178
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6179 _snprintf (lpxstr, len - 1,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6180 "-%s-%s-%s-%c-normal-normal-%s-%s-%d-%d-%c-%s-%s",
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6181 fonttype, /* foundry */
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6182 fontname, /* family */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6183 w32_to_x_weight (lplogfont->lfWeight), /* weight */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6184 lplogfont->lfItalic?'i':'r', /* slant */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6185 /* setwidth name */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6186 /* add style name */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6187 height_pixels, /* pixel size */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6188 height_dpi, /* point size */
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6189 display_resx, /* resx */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6190 display_resy, /* resy */
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6191 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6192 ? 'p' : 'c', /* spacing */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6193 width_pixels, /* avg width */
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6194 specific_charset ? specific_charset
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6195 : w32_to_x_charset (lplogfont->lfCharSet)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6196 /* charset registry and encoding */
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6197 );
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6198
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6199 lpxstr[len - 1] = 0; /* just to be sure */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6200 return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6201 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6202
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6203 static BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6204 x_to_w32_font (lpxstr, lplogfont)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6205 char * lpxstr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6206 LOGFONT * lplogfont;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6207 {
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6208 struct coding_system coding;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6209
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6210 if (!lplogfont) return (FALSE);
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6211
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6212 memset (lplogfont, 0, sizeof (*lplogfont));
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6213
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
6214 /* Set default value for each field. */
15380
8b01836a6b06 (x_to_win32_font): Allow any quality fonts.
Richard M. Stallman <rms@gnu.org>
parents: 15377
diff changeset
6215 #if 1
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6216 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6217 lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6218 lplogfont->lfQuality = DEFAULT_QUALITY;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6219 #else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6220 /* go for maximum quality */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6221 lplogfont->lfOutPrecision = OUT_STROKE_PRECIS;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6222 lplogfont->lfClipPrecision = CLIP_STROKE_PRECIS;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6223 lplogfont->lfQuality = PROOF_QUALITY;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6224 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6225
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
6226 lplogfont->lfCharSet = DEFAULT_CHARSET;
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
6227 lplogfont->lfWeight = FW_DONTCARE;
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
6228 lplogfont->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
6229
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6230 if (!lpxstr)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6231 return FALSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6232
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6233 /* Provide a simple escape mechanism for specifying Windows font names
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6234 * directly -- if font spec does not beginning with '-', assume this
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6235 * format:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6236 * "<font name>[:height in pixels[:width in pixels[:weight]]]"
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6237 */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6238
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6239 if (*lpxstr == '-')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6240 {
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6241 int fields, tem;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6242 char name[50], weight[20], slant, pitch, pixels[10], height[10],
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6243 width[10], resy[10], remainder[20];
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6244 char * encoding;
32791
43fa65d08292 (x_to_w32_font): Initialize dpi from dpyinfo->resy.
Jason Rumney <jasonr@gnu.org>
parents: 32721
diff changeset
6245 int dpi = one_w32_display_info.resy;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6246
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6247 fields = sscanf (lpxstr,
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6248 "-%*[^-]-%49[^-]-%19[^-]-%c-%*[^-]-%*[^-]-%9[^-]-%9[^-]-%*[^-]-%9[^-]-%c-%9[^-]-%19s",
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6249 name, weight, &slant, pixels, height, resy, &pitch, width, remainder);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6250 if (fields == EOF) return (FALSE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6251
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6252 /* If wildcards cover more than one field, we don't know which
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6253 field is which, so don't fill any in. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6254
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6255 if (fields < 9)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6256 fields = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6257
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6258 if (fields > 0 && name[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6259 {
24583
0e5c5bd9b99d (x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents: 24497
diff changeset
6260 int bufsize;
0e5c5bd9b99d (x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents: 24497
diff changeset
6261 unsigned char *buf;
0e5c5bd9b99d (x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents: 24497
diff changeset
6262
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6263 setup_coding_system
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6264 (Fcheck_coding_system (Vw32_system_coding_system), &coding);
29021
be2769eac1a5 (w32_to_x_font): Setup members src_multibyte and
Kenichi Handa <handa@m17n.org>
parents: 28983
diff changeset
6265 coding.src_multibyte = 1;
be2769eac1a5 (w32_to_x_font): Setup members src_multibyte and
Kenichi Handa <handa@m17n.org>
parents: 28983
diff changeset
6266 coding.dst_multibyte = 1;
24583
0e5c5bd9b99d (x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents: 24497
diff changeset
6267 bufsize = encoding_buffer_size (&coding, strlen (name));
0e5c5bd9b99d (x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents: 24497
diff changeset
6268 buf = (unsigned char *) alloca (bufsize);
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6269 coding.mode |= CODING_MODE_LAST_BLOCK;
24583
0e5c5bd9b99d (x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents: 24497
diff changeset
6270 encode_coding (&coding, name, buf, strlen (name), bufsize);
0e5c5bd9b99d (x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents: 24497
diff changeset
6271 if (coding.produced >= LF_FACESIZE)
0e5c5bd9b99d (x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents: 24497
diff changeset
6272 coding.produced = LF_FACESIZE - 1;
0e5c5bd9b99d (x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents: 24497
diff changeset
6273 buf[coding.produced] = 0;
0e5c5bd9b99d (x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents: 24497
diff changeset
6274 strcpy (lplogfont->lfFaceName, buf);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6275 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6276 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6277 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6278 lplogfont->lfFaceName[0] = '\0';
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6279 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6280
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6281 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6282
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6283 lplogfont->lfWeight = x_to_w32_weight ((fields > 0 ? weight : ""));
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6284
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6285 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6286
33879
9bbea0dda9cd (x_to_w32_font): Do not filter out italic fonts, as new
Jason Rumney <jasonr@gnu.org>
parents: 33870
diff changeset
6287 lplogfont->lfItalic = (fields > 0 && slant == 'i');
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6288
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6289 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6290
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6291 if (fields > 0 && pixels[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6292 lplogfont->lfHeight = atoi (pixels);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6293
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6294 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6295 fields--;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6296 if (fields > 0 && resy[0] != '*')
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6297 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6298 tem = atoi (resy);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6299 if (tem > 0) dpi = tem;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6300 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6301
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6302 if (fields > -1 && lplogfont->lfHeight == 0 && height[0] != '*')
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6303 lplogfont->lfHeight = atoi (height) * dpi / 720;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6304
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6305 if (fields > 0)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6306 lplogfont->lfPitchAndFamily =
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6307 (fields > 0 && pitch == 'p') ? VARIABLE_PITCH : FIXED_PITCH;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6308
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6309 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6310
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6311 if (fields > 0 && width[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6312 lplogfont->lfWidth = atoi (width) / 10;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6313
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6314 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6315
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6316 /* Strip the trailing '-' if present. (it shouldn't be, as it
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6317 fails the test against xlfd-tight-regexp in fontset.el). */
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
6318 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6319 int len = strlen (remainder);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6320 if (len > 0 && remainder[len-1] == '-')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6321 remainder[len-1] = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6322 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6323 encoding = remainder;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6324 if (strncmp (encoding, "*-", 2) == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6325 encoding += 2;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6326 lplogfont->lfCharSet = x_to_w32_charset (fields > 0 ? encoding : "");
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6327 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6328 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6329 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6330 int fields;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6331 char name[100], height[10], width[10], weight[20];
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6332
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6333 fields = sscanf (lpxstr,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6334 "%99[^:]:%9[^:]:%9[^:]:%19s",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6335 name, height, width, weight);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6336
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6337 if (fields == EOF) return (FALSE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6338
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6339 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6340 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6341 strncpy (lplogfont->lfFaceName,name, LF_FACESIZE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6342 lplogfont->lfFaceName[LF_FACESIZE-1] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6343 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6344 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6345 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6346 lplogfont->lfFaceName[0] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6347 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6348
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6349 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6350
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6351 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6352 lplogfont->lfHeight = atoi (height);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6353
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6354 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6355
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6356 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6357 lplogfont->lfWidth = atoi (width);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6358
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6359 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6360
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6361 lplogfont->lfWeight = x_to_w32_weight ((fields > 0 ? weight : ""));
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6362 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6363
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6364 /* This makes TrueType fonts work better. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6365 lplogfont->lfHeight = - abs (lplogfont->lfHeight);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6366
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6367 return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6368 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6369
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6370 /* Strip the pixel height and point height from the given xlfd, and
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6371 return the pixel height. If no pixel height is specified, calculate
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6372 one from the point height, or if that isn't defined either, return
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6373 0 (which usually signifies a scalable font).
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6374 */
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6375 static int
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6376 xlfd_strip_height (char *fontname)
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6377 {
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6378 int pixel_height, field_number;
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6379 char *read_from, *write_to;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6380
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6381 xassert (fontname);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6382
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6383 pixel_height = field_number = 0;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6384 write_to = NULL;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6385
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6386 /* Look for height fields. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6387 for (read_from = fontname; *read_from; read_from++)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6388 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6389 if (*read_from == '-')
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6390 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6391 field_number++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6392 if (field_number == 7) /* Pixel height. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6393 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6394 read_from++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6395 write_to = read_from;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6396
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6397 /* Find end of field. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6398 for (;*read_from && *read_from != '-'; read_from++)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6399 ;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6400
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6401 /* Split the fontname at end of field. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6402 if (*read_from)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6403 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6404 *read_from = '\0';
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6405 read_from++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6406 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6407 pixel_height = atoi (write_to);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6408 /* Blank out field. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6409 if (read_from > write_to)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6410 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6411 *write_to = '-';
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6412 write_to++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6413 }
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6414 /* If the pixel height field is at the end (partial xlfd),
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6415 return now. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6416 else
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6417 return pixel_height;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6418
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6419 /* If we got a pixel height, the point height can be
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6420 ignored. Just blank it out and break now. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6421 if (pixel_height)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6422 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6423 /* Find end of point size field. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6424 for (; *read_from && *read_from != '-'; read_from++)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6425 ;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6426
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6427 if (*read_from)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6428 read_from++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6429
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6430 /* Blank out the point size field. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6431 if (read_from > write_to)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6432 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6433 *write_to = '-';
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6434 write_to++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6435 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6436 else
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6437 return pixel_height;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6438
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6439 break;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6440 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6441 /* If the point height is already blank, break now. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6442 if (*read_from == '-')
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6443 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6444 read_from++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6445 break;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6446 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6447 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6448 else if (field_number == 8)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6449 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6450 /* If we didn't get a pixel height, try to get the point
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6451 height and convert that. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6452 int point_size;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6453 char *point_size_start = read_from++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6454
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6455 /* Find end of field. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6456 for (; *read_from && *read_from != '-'; read_from++)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6457 ;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6458
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6459 if (*read_from)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6460 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6461 *read_from = '\0';
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6462 read_from++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6463 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6464
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6465 point_size = atoi (point_size_start);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6466
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6467 /* Convert to pixel height. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6468 pixel_height = point_size
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6469 * one_w32_display_info.height_in / 720;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6470
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6471 /* Blank out this field and break. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6472 *write_to = '-';
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6473 write_to++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6474 break;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6475 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6476 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6477 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6478
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6479 /* Shift the rest of the font spec into place. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6480 if (write_to && read_from > write_to)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6481 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6482 for (; *read_from; read_from++, write_to++)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6483 *write_to = *read_from;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6484 *write_to = '\0';
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6485 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6486
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6487 return pixel_height;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6488 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6489
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6490 /* Assume parameter 1 is fully qualified, no wildcards. */
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6491 static BOOL
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6492 w32_font_match (fontname, pattern)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6493 char * fontname;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6494 char * pattern;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6495 {
35674
62b578dd28ce (w32_font_match): Allocate three more bytes to regex
Kenichi Handa <handa@m17n.org>
parents: 35359
diff changeset
6496 char *regex = alloca (strlen (pattern) * 2 + 3);
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6497 char *font_name_copy = alloca (strlen (fontname) + 1);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6498 char *ptr;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6499
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6500 /* Copy fontname so we can modify it during comparison. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6501 strcpy (font_name_copy, fontname);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6502
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6503 ptr = regex;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6504 *ptr++ = '^';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6505
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6506 /* Turn pattern into a regexp and do a regexp match. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6507 for (; *pattern; pattern++)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6508 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6509 if (*pattern == '?')
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6510 *ptr++ = '.';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6511 else if (*pattern == '*')
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6512 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6513 *ptr++ = '.';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6514 *ptr++ = '*';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6515 }
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6516 else
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6517 *ptr++ = *pattern;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6518 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6519 *ptr = '$';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6520 *(ptr + 1) = '\0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6521
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6522 /* Strip out font heights and compare them seperately, since
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6523 rounding error can cause mismatches. This also allows a
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6524 comparison between a font that declares only a pixel height and a
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6525 pattern that declares the point height.
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6526 */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6527 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6528 int font_height, pattern_height;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6529
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6530 font_height = xlfd_strip_height (font_name_copy);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6531 pattern_height = xlfd_strip_height (regex);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6532
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6533 /* Compare now, and don't bother doing expensive regexp matching
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6534 if the heights differ. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6535 if (font_height && pattern_height && (font_height != pattern_height))
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6536 return FALSE;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6537 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6538
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6539 return (fast_c_string_match_ignore_case (build_string (regex),
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
6540 font_name_copy) >= 0);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6541 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6542
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6543 /* Callback functions, and a structure holding info they need, for
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6544 listing system fonts on W32. We need one set of functions to do the
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6545 job properly, but these don't work on NT 3.51 and earlier, so we
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6546 have a second set which don't handle character sets properly to
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6547 fall back on.
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6548
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6549 In both cases, there are two passes made. The first pass gets one
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6550 font from each family, the second pass lists all the fonts from
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6551 each family. */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6552
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6553 typedef struct enumfont_t
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6554 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6555 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6556 int numFonts;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6557 LOGFONT logfont;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6558 XFontStruct *size_ref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6559 Lisp_Object *pattern;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6560 Lisp_Object *tail;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6561 } enumfont_t;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6562
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6563 static int CALLBACK
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6564 enum_font_cb2 (lplf, lptm, FontType, lpef)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6565 ENUMLOGFONT * lplf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6566 NEWTEXTMETRIC * lptm;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6567 int FontType;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6568 enumfont_t * lpef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6569 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6570 if (lplf->elfLogFont.lfStrikeOut || lplf->elfLogFont.lfUnderline)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6571 return (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6572
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6573 /* Check that the character set matches if it was specified */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6574 if (lpef->logfont.lfCharSet != DEFAULT_CHARSET &&
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6575 lplf->elfLogFont.lfCharSet != lpef->logfont.lfCharSet)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6576 return (1);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6577
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6578 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6579 char buf[100];
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6580 Lisp_Object width = Qnil;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6581 char *charset = NULL;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6582
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6583 /* Truetype fonts do not report their true metrics until loaded */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6584 if (FontType != RASTER_FONTTYPE)
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6585 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6586 if (!NILP (*(lpef->pattern)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6587 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6588 /* Scalable fonts are as big as you want them to be. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6589 lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6590 lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6591 width = make_number (lpef->logfont.lfWidth);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6592 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6593 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6594 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6595 lplf->elfLogFont.lfHeight = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6596 lplf->elfLogFont.lfWidth = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6597 }
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
6598 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6599
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6600 /* Make sure the height used here is the same as everywhere
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6601 else (ie character height, not cell height). */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6602 if (lplf->elfLogFont.lfHeight > 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6603 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6604 /* lptm can be trusted for RASTER fonts, but not scalable ones. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6605 if (FontType == RASTER_FONTTYPE)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6606 lplf->elfLogFont.lfHeight = lptm->tmInternalLeading - lptm->tmHeight;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6607 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6608 lplf->elfLogFont.lfHeight = -lplf->elfLogFont.lfHeight;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6609 }
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6610
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6611 if (!NILP (*(lpef->pattern)))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6612 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6613 charset = xlfd_charset_of_font (XSTRING(*(lpef->pattern))->data);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6614
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6615 /* Ensure that charset is valid for this font. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6616 if (charset
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6617 && (x_to_w32_charset (charset) != lplf->elfLogFont.lfCharSet))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6618 charset = NULL;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6619 }
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6620
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6621 /* TODO: List all relevant charsets if charset not specified. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6622 if (!w32_to_x_font (&(lplf->elfLogFont), buf, 100, charset))
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6623 return (0);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6624
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6625 if (NILP (*(lpef->pattern))
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6626 || w32_font_match (buf, XSTRING (*(lpef->pattern))->data))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6627 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6628 *lpef->tail = Fcons (Fcons (build_string (buf), width), Qnil);
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6629 lpef->tail = &(XCDR (*lpef->tail));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6630 lpef->numFonts++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6631 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6632 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6633
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6634 return (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6635 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6636
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6637 static int CALLBACK
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6638 enum_font_cb1 (lplf, lptm, FontType, lpef)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6639 ENUMLOGFONT * lplf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6640 NEWTEXTMETRIC * lptm;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6641 int FontType;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6642 enumfont_t * lpef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6643 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6644 return EnumFontFamilies (lpef->hdc,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6645 lplf->elfLogFont.lfFaceName,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6646 (FONTENUMPROC) enum_font_cb2,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6647 (LPARAM) lpef);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6648 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6649
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6650
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6651 static int CALLBACK
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6652 enum_fontex_cb2 (lplf, lptm, font_type, lpef)
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6653 ENUMLOGFONTEX * lplf;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6654 NEWTEXTMETRICEX * lptm;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6655 int font_type;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6656 enumfont_t * lpef;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6657 {
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6658 /* We are not interested in the extra info we get back from the 'Ex
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6659 version - only the fact that we get character set variations
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6660 enumerated seperately. */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6661 return enum_font_cb2 ((ENUMLOGFONT *) lplf, (NEWTEXTMETRIC *) lptm,
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6662 font_type, lpef);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6663 }
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6664
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6665 static int CALLBACK
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6666 enum_fontex_cb1 (lplf, lptm, font_type, lpef)
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6667 ENUMLOGFONTEX * lplf;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6668 NEWTEXTMETRICEX * lptm;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6669 int font_type;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6670 enumfont_t * lpef;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6671 {
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6672 HMODULE gdi32 = GetModuleHandle ("gdi32.dll");
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6673 FARPROC enum_font_families_ex
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6674 = GetProcAddress ( gdi32, "EnumFontFamiliesExA");
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6675 /* We don't really expect EnumFontFamiliesEx to disappear once we
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6676 get here, so don't bother handling it gracefully. */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6677 if (enum_font_families_ex == NULL)
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6678 error ("gdi32.dll has disappeared!");
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6679 return enum_font_families_ex (lpef->hdc,
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6680 &lplf->elfLogFont,
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6681 (FONTENUMPROC) enum_fontex_cb2,
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6682 (LPARAM) lpef, 0);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6683 }
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6684
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6685 /* Interface to fontset handler. (adapted from mw32font.c in Meadow
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6686 and xterm.c in Emacs 20.3) */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6687
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6688 static Lisp_Object w32_list_bdf_fonts (Lisp_Object pattern, int max_names)
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6689 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6690 char *fontname, *ptnstr;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6691 Lisp_Object list, tem, newlist = Qnil;
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
6692 int n_fonts = 0;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6693
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6694 list = Vw32_bdf_filename_alist;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6695 ptnstr = XSTRING (pattern)->data;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6696
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6697 for ( ; CONSP (list); list = XCDR (list))
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6698 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6699 tem = XCAR (list);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6700 if (CONSP (tem))
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6701 fontname = XSTRING (XCAR (tem))->data;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6702 else if (STRINGP (tem))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6703 fontname = XSTRING (tem)->data;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6704 else
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6705 continue;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6706
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6707 if (w32_font_match (fontname, ptnstr))
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6708 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6709 newlist = Fcons (XCAR (tem), newlist);
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6710 n_fonts++;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6711 if (n_fonts >= max_names)
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6712 break;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6713 }
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6714 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6715
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6716 return newlist;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6717 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6718
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6719 static Lisp_Object w32_list_synthesized_fonts (FRAME_PTR f,
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6720 Lisp_Object pattern,
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6721 int size, int max_names);
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6722
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6723 /* Return a list of names of available fonts matching PATTERN on frame
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6724 F. If SIZE is not 0, it is the size (maximum bound width) of fonts
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6725 to be listed. Frame F NULL means we have not yet created any
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6726 frame, which means we can't get proper size info, as we don't have
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6727 a device context to use for GetTextMetrics.
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6728 MAXNAMES sets a limit on how many fonts to match. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6729
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6730 Lisp_Object
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
6731 w32_list_fonts (f, pattern, size, maxnames)
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
6732 struct frame *f;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
6733 Lisp_Object pattern;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
6734 int size;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
6735 int maxnames;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6736 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6737 Lisp_Object patterns, key = Qnil, tem, tpat;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6738 Lisp_Object list = Qnil, newlist = Qnil, second_best = Qnil;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6739 struct w32_display_info *dpyinfo = &one_w32_display_info;
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6740 int n_fonts = 0;
23637
54b22e0a1f7b (w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents: 23620
diff changeset
6741
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6742 patterns = Fassoc (pattern, Valternate_fontname_alist);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6743 if (NILP (patterns))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6744 patterns = Fcons (pattern, Qnil);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6745
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6746 for (; CONSP (patterns); patterns = XCDR (patterns))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6747 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6748 enumfont_t ef;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6749 int codepage;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6750
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6751 tpat = XCAR (patterns);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6752
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6753 if (!STRINGP (tpat))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6754 continue;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6755
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6756 /* Avoid expensive EnumFontFamilies functions if we are not
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6757 going to be able to output one of these anyway. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6758 codepage = w32_codepage_for_font (XSTRING (tpat)->data);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6759 if (codepage != CP_8BIT && codepage != CP_UNICODE
34284
3a21ff35392b (xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents: 34133
diff changeset
6760 && codepage != CP_DEFAULT && codepage != CP_UNKNOWN
3a21ff35392b (xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents: 34133
diff changeset
6761 && !IsValidCodePage(codepage))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6762 continue;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6763
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6764 /* See if we cached the result for this particular query.
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6765 The cache is an alist of the form:
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6766 ((PATTERN (FONTNAME . WIDTH) ...) ...)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6767 */
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6768 if (tem = XCDR (dpyinfo->name_list_element),
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6769 !NILP (list = Fassoc (tpat, tem)))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6770 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6771 list = Fcdr_safe (list);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6772 /* We have a cached list. Don't have to get the list again. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6773 goto label_cached;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6774 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6775
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6776 BLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6777 /* At first, put PATTERN in the cache. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6778 list = Qnil;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6779 ef.pattern = &tpat;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6780 ef.tail = &list;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6781 ef.numFonts = 0;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6782
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6783 /* Use EnumFontFamiliesEx where it is available, as it knows
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6784 about character sets. Fall back to EnumFontFamilies for
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6785 older versions of NT that don't support the 'Ex function. */
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6786 x_to_w32_font (XSTRING (tpat)->data, &ef.logfont);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6787 {
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6788 LOGFONT font_match_pattern;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6789 HMODULE gdi32 = GetModuleHandle ("gdi32.dll");
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6790 FARPROC enum_font_families_ex
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6791 = GetProcAddress ( gdi32, "EnumFontFamiliesExA");
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6792
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6793 /* We do our own pattern matching so we can handle wildcards. */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6794 font_match_pattern.lfFaceName[0] = 0;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6795 font_match_pattern.lfPitchAndFamily = 0;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6796 /* We can use the charset, because if it is a wildcard it will
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6797 be DEFAULT_CHARSET anyway. */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6798 font_match_pattern.lfCharSet = ef.logfont.lfCharSet;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6799
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6800 ef.hdc = GetDC (dpyinfo->root_window);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6801
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6802 if (enum_font_families_ex)
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6803 enum_font_families_ex (ef.hdc,
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6804 &font_match_pattern,
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6805 (FONTENUMPROC) enum_fontex_cb1,
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6806 (LPARAM) &ef, 0);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6807 else
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6808 EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1,
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6809 (LPARAM)&ef);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6810
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6811 ReleaseDC (dpyinfo->root_window, ef.hdc);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6812 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6813
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6814 UNBLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6815
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6816 /* Make a list of the fonts we got back.
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6817 Store that in the font cache for the display. */
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6818 XCDR (dpyinfo->name_list_element)
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6819 = Fcons (Fcons (tpat, list),
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6820 XCDR (dpyinfo->name_list_element));
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6821
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6822 label_cached:
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6823 if (NILP (list)) continue; /* Try the remaining alternatives. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6824
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6825 newlist = second_best = Qnil;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6826
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6827 /* Make a list of the fonts that have the right width. */
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6828 for (; CONSP (list); list = XCDR (list))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6829 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6830 int found_size;
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6831 tem = XCAR (list);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6832
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6833 if (!CONSP (tem))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6834 continue;
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6835 if (NILP (XCAR (tem)))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6836 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6837 if (!size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6838 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6839 newlist = Fcons (XCAR (tem), newlist);
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6840 n_fonts++;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6841 if (n_fonts >= maxnames)
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6842 break;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6843 else
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6844 continue;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6845 }
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6846 if (!INTEGERP (XCDR (tem)))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6847 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6848 /* Since we don't yet know the size of the font, we must
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6849 load it and try GetTextMetrics. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6850 W32FontStruct thisinfo;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6851 LOGFONT lf;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6852 HDC hdc;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6853 HANDLE oldobj;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6854
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6855 if (!x_to_w32_font (XSTRING (XCAR (tem))->data, &lf))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6856 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6857
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6858 BLOCK_INPUT;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6859 thisinfo.bdf = NULL;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6860 thisinfo.hfont = CreateFontIndirect (&lf);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6861 if (thisinfo.hfont == NULL)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6862 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6863
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6864 hdc = GetDC (dpyinfo->root_window);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6865 oldobj = SelectObject (hdc, thisinfo.hfont);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6866 if (GetTextMetrics (hdc, &thisinfo.tm))
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6867 XCDR (tem) = make_number (FONT_WIDTH (&thisinfo));
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6868 else
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6869 XCDR (tem) = make_number (0);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6870 SelectObject (hdc, oldobj);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6871 ReleaseDC (dpyinfo->root_window, hdc);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6872 DeleteObject(thisinfo.hfont);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6873 UNBLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6874 }
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6875 found_size = XINT (XCDR (tem));
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6876 if (found_size == size)
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6877 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6878 newlist = Fcons (XCAR (tem), newlist);
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6879 n_fonts++;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6880 if (n_fonts >= maxnames)
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6881 break;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6882 }
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6883 /* keep track of the closest matching size in case
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6884 no exact match is found. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6885 else if (found_size > 0)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6886 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6887 if (NILP (second_best))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6888 second_best = tem;
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6889
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6890 else if (found_size < size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6891 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6892 if (XINT (XCDR (second_best)) > size
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6893 || XINT (XCDR (second_best)) < found_size)
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6894 second_best = tem;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6895 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6896 else
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6897 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6898 if (XINT (XCDR (second_best)) > size
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6899 && XINT (XCDR (second_best)) >
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6900 found_size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6901 second_best = tem;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6902 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6903 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6904 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6905
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6906 if (!NILP (newlist))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6907 break;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6908 else if (!NILP (second_best))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6909 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6910 newlist = Fcons (XCAR (second_best), Qnil);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6911 break;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6912 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6913 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6914
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6915 /* Include any bdf fonts. */
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6916 if (n_fonts < maxnames)
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6917 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6918 Lisp_Object combined[2];
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6919 combined[0] = w32_list_bdf_fonts (pattern, maxnames - n_fonts);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6920 combined[1] = newlist;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6921 newlist = Fnconc(2, combined);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6922 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6923
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6924 /* If we can't find a font that matches, check if Windows would be
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6925 able to synthesize it from a different style. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6926 if (NILP (newlist) && !NILP (Vw32_enable_synthesized_fonts))
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6927 newlist = w32_list_synthesized_fonts (f, pattern, size, maxnames);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6928
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6929 return newlist;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6930 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6931
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6932 static Lisp_Object
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6933 w32_list_synthesized_fonts (f, pattern, size, max_names)
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6934 FRAME_PTR f;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6935 Lisp_Object pattern;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6936 int size;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6937 int max_names;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6938 {
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6939 int fields;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6940 char *full_pattn, *new_pattn, foundary[50], family[50], *pattn_part2;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6941 char style[20], slant;
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6942 Lisp_Object matches, tem, synthed_matches = Qnil;
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6943
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6944 full_pattn = XSTRING (pattern)->data;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6945
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6946 pattn_part2 = alloca (XSTRING (pattern)->size);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6947 /* Allow some space for wildcard expansion. */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6948 new_pattn = alloca (XSTRING (pattern)->size + 100);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6949
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6950 fields = sscanf (full_pattn, "-%49[^-]-%49[^-]-%19[^-]-%c-%s",
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6951 foundary, family, style, &slant, pattn_part2);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6952 if (fields == EOF || fields < 5)
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6953 return Qnil;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6954
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6955 /* If the style and slant are wildcards already there is no point
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6956 checking again (and we don't want to keep recursing). */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6957 if (*style == '*' && slant == '*')
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6958 return Qnil;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6959
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6960 sprintf (new_pattn, "-%s-%s-*-*-%s", foundary, family, pattn_part2);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6961
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6962 matches = w32_list_fonts (f, build_string (new_pattn), size, max_names);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6963
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6964 for ( ; CONSP (matches); matches = XCDR (matches))
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6965 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6966 tem = XCAR (matches);
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6967 if (!STRINGP (tem))
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6968 continue;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6969
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6970 full_pattn = XSTRING (tem)->data;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6971 fields = sscanf (full_pattn, "-%49[^-]-%49[^-]-%*[^-]-%*c-%s",
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6972 foundary, family, pattn_part2);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6973 if (fields == EOF || fields < 3)
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6974 continue;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6975
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6976 sprintf (new_pattn, "-%s-%s-%s-%c-%s", foundary, family, style,
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6977 slant, pattn_part2);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6978
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6979 synthed_matches = Fcons (build_string (new_pattn),
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6980 synthed_matches);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6981 }
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6982
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6983 return synthed_matches;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6984 }
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6985
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6986
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6987 /* Return a pointer to struct font_info of font FONT_IDX of frame F. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6988 struct font_info *
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6989 w32_get_font_info (f, font_idx)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6990 FRAME_PTR f;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6991 int font_idx;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6992 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6993 return (FRAME_W32_FONT_TABLE (f) + font_idx);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6994 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6995
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6996
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6997 struct font_info*
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6998 w32_query_font (struct frame *f, char *fontname)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6999 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7000 int i;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7001 struct font_info *pfi;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7002
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7003 pfi = FRAME_W32_FONT_TABLE (f);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7004
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7005 for (i = 0; i < one_w32_display_info.n_fonts ;i++, pfi++)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7006 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7007 if (strcmp(pfi->name, fontname) == 0) return pfi;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7008 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7009
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7010 return NULL;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7011 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7012
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7013 /* Find a CCL program for a font specified by FONTP, and set the member
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7014 `encoder' of the structure. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7015
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7016 void
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7017 w32_find_ccl_program (fontp)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7018 struct font_info *fontp;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7019 {
25069
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
7020 Lisp_Object list, elt;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7021
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
7022 for (list = Vfont_ccl_encoder_alist; CONSP (list); list = XCDR (list))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7023 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
7024 elt = XCAR (list);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7025 if (CONSP (elt)
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
7026 && STRINGP (XCAR (elt))
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
7027 && (fast_c_string_match_ignore_case (XCAR (elt), fontp->name)
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7028 >= 0))
25069
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
7029 break;
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
7030 }
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
7031 if (! NILP (list))
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
7032 {
25084
d89aa269255d (w32_find_ccl_program): Add casting.
Kenichi Handa <handa@m17n.org>
parents: 25069
diff changeset
7033 struct ccl_program *ccl
d89aa269255d (w32_find_ccl_program): Add casting.
Kenichi Handa <handa@m17n.org>
parents: 25069
diff changeset
7034 = (struct ccl_program *) xmalloc (sizeof (struct ccl_program));
25069
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
7035
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
7036 if (setup_ccl_program (ccl, XCDR (elt)) < 0)
25069
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
7037 xfree (ccl);
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
7038 else
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
7039 fontp->font_encoder = ccl;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7040 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7041 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7042
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7043
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7044 /* Find BDF files in a specified directory. (use GCPRO when calling,
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7045 as this calls lisp to get a directory listing). */
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7046 static Lisp_Object
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7047 w32_find_bdf_fonts_in_dir (Lisp_Object directory)
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7048 {
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7049 Lisp_Object filelist, list = Qnil;
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7050 char fontname[100];
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7051
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7052 if (!STRINGP(directory))
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7053 return Qnil;
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7054
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7055 filelist = Fdirectory_files (directory, Qt,
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7056 build_string (".*\\.[bB][dD][fF]"), Qt);
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7057
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7058 for ( ; CONSP(filelist); filelist = XCDR (filelist))
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7059 {
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7060 Lisp_Object filename = XCAR (filelist);
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7061 if (w32_BDF_to_x_font (XSTRING (filename)->data, fontname, 100))
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7062 store_in_alist (&list, build_string (fontname), filename);
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7063 }
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7064 return list;
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7065 }
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7066
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7067 DEFUN ("w32-find-bdf-fonts", Fw32_find_bdf_fonts, Sw32_find_bdf_fonts,
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7068 1, 1, 0,
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7069 "Return a list of BDF fonts in DIR, suitable for appending to\n\
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
7070 w32-bdf-filename-alist. Fonts which do not contain an xlfd description\n\
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7071 will not be included in the list. DIR may be a list of directories.")
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7072 (directory)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7073 Lisp_Object directory;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7074 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7075 Lisp_Object list = Qnil;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7076 struct gcpro gcpro1, gcpro2;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7077
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7078 if (!CONSP (directory))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7079 return w32_find_bdf_fonts_in_dir (directory);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7080
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
7081 for ( ; CONSP (directory); directory = XCDR (directory))
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7082 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7083 Lisp_Object pair[2];
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7084 pair[0] = list;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7085 pair[1] = Qnil;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7086 GCPRO2 (directory, list);
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
7087 pair[1] = w32_find_bdf_fonts_in_dir( XCAR (directory) );
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7088 list = Fnconc( 2, pair );
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7089 UNGCPRO;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7090 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7091 return list;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7092 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7093
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7094
26729
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25646
diff changeset
7095 DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7096 "Internal function called by `color-defined-p', which see.")
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7097 (color, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7098 Lisp_Object color, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7099 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7100 XColor foo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7101 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7102
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7103 CHECK_STRING (color, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7104
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7105 if (w32_defined_color (f, XSTRING (color)->data, &foo, 0))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7106 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7107 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7108 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7109 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7110
26729
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25646
diff changeset
7111 DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7112 "Internal function called by `color-values', which see.")
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7113 (color, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7114 Lisp_Object color, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7115 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7116 XColor foo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7117 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7118
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7119 CHECK_STRING (color, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7120
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7121 if (w32_defined_color (f, XSTRING (color)->data, &foo, 0))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7122 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7123 Lisp_Object rgb[3];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7124
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7125 rgb[0] = make_number ((GetRValue (foo.pixel) << 8)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7126 | GetRValue (foo.pixel));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7127 rgb[1] = make_number ((GetGValue (foo.pixel) << 8)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7128 | GetGValue (foo.pixel));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7129 rgb[2] = make_number ((GetBValue (foo.pixel) << 8)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7130 | GetBValue (foo.pixel));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7131 return Flist (3, rgb);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7132 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7133 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7134 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7135 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7136
26729
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25646
diff changeset
7137 DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7138 "Internal function called by `display-color-p', which see.")
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7139 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7140 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7141 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7142 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7143
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7144 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 2)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7145 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7146
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7147 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7148 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7149
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7150 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7151 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7152 "Return t if the X display supports shades of gray.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7153 Note that color displays do support shades of gray.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7154 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7155 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7156 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7157 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7158 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7159 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7160 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7161
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7162 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7163 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7164
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7165 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7166 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7167
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7168 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7169 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7170 "Returns the width in pixels of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7171 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7172 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7173 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7174 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7175 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7176 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7177 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7178
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7179 return make_number (dpyinfo->width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7180 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7181
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7182 DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7183 Sx_display_pixel_height, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7184 "Returns the height in pixels of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7185 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7186 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7187 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7188 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7189 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7190 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7191 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7192
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7193 return make_number (dpyinfo->height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7194 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7195
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7196 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7197 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7198 "Returns the number of bitplanes of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7199 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7200 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7201 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7202 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7203 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7204 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7205 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7206
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7207 return make_number (dpyinfo->n_planes * dpyinfo->n_cbits);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7208 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7209
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7210 DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7211 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7212 "Returns the number of color cells of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7213 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7214 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7215 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7216 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7217 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7218 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7219 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7220 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7221 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7222
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7223 hdc = GetDC (dpyinfo->root_window);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7224 if (dpyinfo->has_palette)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7225 cap = GetDeviceCaps (hdc,SIZEPALETTE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7226 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7227 cap = GetDeviceCaps (hdc,NUMCOLORS);
34998
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7228
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7229 if (cap < 0)
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7230 cap = 1 << (dpyinfo->n_planes * dpyinfo->n_cbits);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7231
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7232 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7233
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7234 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7235 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7236
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7237 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7238 Sx_server_max_request_size,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7239 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7240 "Returns the maximum request size of the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7241 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7242 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7243 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7244 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7245 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7246 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7247 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7248
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7249 return make_number (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7250 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7251
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7252 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7253 "Returns the vendor ID string of the W32 system (Microsoft).\n\
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7254 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7255 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7256 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7257 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7258 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7259 {
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7260 return build_string ("Microsoft Corp.");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7261 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7262
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7263 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7264 "Returns the version numbers of the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7265 The value is a list of three integers: the major and minor\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7266 version numbers, and the vendor-specific release\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7267 number. See also the function `x-server-vendor'.\n\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7268 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7269 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7270 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7271 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7272 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7273 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7274 return Fcons (make_number (w32_major_version),
33216
2eb7d429a997 (Fx_server_version): Include w32_build_number in the
Andrew Innes <andrewi@gnu.org>
parents: 32977
diff changeset
7275 Fcons (make_number (w32_minor_version),
2eb7d429a997 (Fx_server_version): Include w32_build_number in the
Andrew Innes <andrewi@gnu.org>
parents: 32977
diff changeset
7276 Fcons (make_number (w32_build_number), Qnil)));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7277 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7278
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7279 DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7280 "Returns the number of screens on the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7281 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7282 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7283 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7284 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7285 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7286 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7287 return make_number (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7288 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7289
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7290 DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7291 "Returns the height in millimeters of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7292 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7293 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7294 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7295 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7296 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7297 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7298 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7299 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7300 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7301
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7302 hdc = GetDC (dpyinfo->root_window);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
7303
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7304 cap = GetDeviceCaps (hdc, VERTSIZE);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
7305
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7306 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7307
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7308 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7309 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7310
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7311 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7312 "Returns the width in millimeters of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7313 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7314 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7315 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7316 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7317 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7318 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7319 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7320
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7321 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7322 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7323
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7324 hdc = GetDC (dpyinfo->root_window);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
7325
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7326 cap = GetDeviceCaps (hdc, HORZSIZE);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
7327
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7328 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7329
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7330 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7331 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7332
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7333 DEFUN ("x-display-backing-store", Fx_display_backing_store,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7334 Sx_display_backing_store, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7335 "Returns an indication of whether display DISPLAY does backing store.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7336 The value may be `always', `when-mapped', or `not-useful'.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7337 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7338 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7339 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7340 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7341 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7342 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7343 return intern ("not-useful");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7344 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7345
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7346 DEFUN ("x-display-visual-class", Fx_display_visual_class,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7347 Sx_display_visual_class, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7348 "Returns the visual class of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7349 The value is one of the symbols `static-gray', `gray-scale',\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7350 `static-color', `pseudo-color', `true-color', or `direct-color'.\n\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7351 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7352 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7353 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7354 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7355 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7356 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7357 struct w32_display_info *dpyinfo = check_x_display_info (display);
34998
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7358 Lisp_Object result = Qnil;
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7359
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7360 if (dpyinfo->has_palette)
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7361 result = intern ("pseudo-color");
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7362 else if (dpyinfo->n_planes * dpyinfo->n_cbits == 1)
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7363 result = intern ("static-grey");
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7364 else if (dpyinfo->n_planes * dpyinfo->n_cbits == 4)
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7365 result = intern ("static-color");
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7366 else if (dpyinfo->n_planes * dpyinfo->n_cbits > 8)
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7367 result = intern ("true-color");
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7368
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
7369 return result;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7370 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7371
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7372 DEFUN ("x-display-save-under", Fx_display_save_under,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7373 Sx_display_save_under, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7374 "Returns t if the display DISPLAY supports the save-under feature.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7375 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7376 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7377 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7378 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7379 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7380 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7381 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7382 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7383
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7384 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7385 x_pixel_width (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7386 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7387 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7388 return PIXEL_WIDTH (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7389 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7390
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7391 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7392 x_pixel_height (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7393 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7394 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7395 return PIXEL_HEIGHT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7396 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7397
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7398 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7399 x_char_width (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7400 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7401 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7402 return FONT_WIDTH (f->output_data.w32->font);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7403 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7404
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7405 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7406 x_char_height (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7407 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7408 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7409 return f->output_data.w32->line_height;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7410 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7411
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7412 int
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7413 x_screen_planes (f)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7414 register struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7415 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7416 return FRAME_W32_DISPLAY_INFO (f)->n_planes;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7417 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7418
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7419 /* Return the display structure for the display named NAME.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7420 Open a new connection if necessary. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7421
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7422 struct w32_display_info *
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7423 x_display_info_for_name (name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7424 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7425 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7426 Lisp_Object names;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7427 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7428
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7429 CHECK_STRING (name, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7430
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7431 for (dpyinfo = &one_w32_display_info, names = w32_display_name_list;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7432 dpyinfo;
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
7433 dpyinfo = dpyinfo->next, names = XCDR (names))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7434 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7435 Lisp_Object tem;
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
7436 tem = Fstring_equal (XCAR (XCAR (names)), name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7437 if (!NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7438 return dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7439 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7440
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7441 /* Use this general default value to start with. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7442 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7443
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7444 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7445
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7446 dpyinfo = w32_term_init (name, (unsigned char *)0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7447 (char *) XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7448
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7449 if (dpyinfo == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7450 error ("Cannot connect to server %s", XSTRING (name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7451
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7452 w32_in_use = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7453 XSETFASTINT (Vwindow_system_version, 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7454
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7455 return dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7456 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7457
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7458 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7459 1, 3, 0, "Open a connection to a server.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7460 DISPLAY is the name of the display to connect to.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7461 Optional second arg XRM-STRING is a string of resources in xrdb format.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7462 If the optional third arg MUST-SUCCEED is non-nil,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7463 terminate Emacs if we can't open the connection.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7464 (display, xrm_string, must_succeed)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7465 Lisp_Object display, xrm_string, must_succeed;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7466 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7467 unsigned char *xrm_option;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7468 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7469
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7470 CHECK_STRING (display, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7471 if (! NILP (xrm_string))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7472 CHECK_STRING (xrm_string, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7473
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7474 if (! EQ (Vwindow_system, intern ("w32")))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7475 error ("Not using Microsoft Windows");
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7476
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7477 /* Allow color mapping to be defined externally; first look in user's
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7478 HOME directory, then in Emacs etc dir for a file called rgb.txt. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7479 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7480 Lisp_Object color_file;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7481 struct gcpro gcpro1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7482
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7483 color_file = build_string("~/rgb.txt");
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7484
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7485 GCPRO1 (color_file);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7486
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7487 if (NILP (Ffile_readable_p (color_file)))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7488 color_file =
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7489 Fexpand_file_name (build_string ("rgb.txt"),
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7490 Fsymbol_value (intern ("data-directory")));
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7491
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7492 Vw32_color_map = Fw32_load_color_file (color_file);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7493
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7494 UNGCPRO;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7495 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7496 if (NILP (Vw32_color_map))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7497 Vw32_color_map = Fw32_default_color_map ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7498
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7499 if (! NILP (xrm_string))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7500 xrm_option = (unsigned char *) XSTRING (xrm_string)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7501 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7502 xrm_option = (unsigned char *) 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7503
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7504 /* Use this general default value to start with. */
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7505 /* First remove .exe suffix from invocation-name - it looks ugly. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7506 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7507 char basename[ MAX_PATH ], *str;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7508
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7509 strcpy (basename, XSTRING (Vinvocation_name)->data);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7510 str = strrchr (basename, '.');
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7511 if (str) *str = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7512 Vinvocation_name = build_string (basename);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7513 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7514 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7515
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7516 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7517
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7518 /* This is what opens the connection and sets x_current_display.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7519 This also initializes many symbols, such as those used for input. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7520 dpyinfo = w32_term_init (display, xrm_option,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7521 (char *) XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7522
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7523 if (dpyinfo == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7524 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7525 if (!NILP (must_succeed))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
7526 fatal ("Cannot connect to server %s.\n",
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
7527 XSTRING (display)->data);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7528 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7529 error ("Cannot connect to server %s", XSTRING (display)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7530 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7531
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7532 w32_in_use = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7533
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7534 XSETFASTINT (Vwindow_system_version, 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7535 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7536 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7537
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7538 DEFUN ("x-close-connection", Fx_close_connection,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7539 Sx_close_connection, 1, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7540 "Close the connection to DISPLAY's server.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7541 For DISPLAY, specify either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7542 If DISPLAY is nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7543 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7544 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7545 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7546 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7547 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7548
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7549 if (dpyinfo->reference_count > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7550 error ("Display still has frames on it");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7551
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7552 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7553 /* Free the fonts in the font table. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7554 for (i = 0; i < dpyinfo->n_fonts; i++)
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7555 if (dpyinfo->font_table[i].name)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7556 {
28272
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
7557 if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name)
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
7558 xfree (dpyinfo->font_table[i].full_name);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7559 xfree (dpyinfo->font_table[i].name);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7560 w32_unload_font (dpyinfo, dpyinfo->font_table[i].font);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7561 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7562 x_destroy_all_bitmaps (dpyinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7563
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7564 x_delete_display (dpyinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7565 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7566
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7567 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7568 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7569
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7570 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7571 "Return the list of display names that Emacs has connections to.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7572 ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7573 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7574 Lisp_Object tail, result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7575
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7576 result = Qnil;
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
7577 for (tail = w32_display_name_list; ! NILP (tail); tail = XCDR (tail))
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
7578 result = Fcons (XCAR (XCAR (tail)), result);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7579
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7580 return result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7581 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7582
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7583 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7584 "If ON is non-nil, report errors as soon as the erring request is made.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7585 If ON is nil, allow buffering of requests.\n\
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7586 This is a noop on W32 systems.\n\
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7587 The optional second argument DISPLAY specifies which display to act on.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7588 DISPLAY should be either a frame or a display name (a string).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7589 If DISPLAY is omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7590 (on, display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7591 Lisp_Object display, on;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7592 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7593 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7594 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7595
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7596
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7597
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7598 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7599 Image types
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7600 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7601
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7602 /* Value is the number of elements of vector VECTOR. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7603
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7604 #define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7605
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7606 /* List of supported image types. Use define_image_type to add new
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7607 types. Use lookup_image_type to find a type for a given symbol. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7608
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7609 static struct image_type *image_types;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7610
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7611 /* The symbol `image' which is the car of the lists used to represent
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7612 images in Lisp. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7613
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7614 extern Lisp_Object Qimage;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7615
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7616 /* The symbol `xbm' which is used as the type symbol for XBM images. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7617
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7618 Lisp_Object Qxbm;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7619
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7620 /* Keywords. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7621
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7622 extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7623 extern Lisp_Object QCdata;
28272
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
7624 Lisp_Object QCtype, QCascent, QCmargin, QCrelief;
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
7625 Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7626 Lisp_Object QCindex;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7627
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7628 /* Other symbols. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7629
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7630 Lisp_Object Qlaplace;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7631
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7632 /* Time in seconds after which images should be removed from the cache
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7633 if not displayed. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7634
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7635 Lisp_Object Vimage_cache_eviction_delay;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7636
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7637 /* Function prototypes. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7638
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7639 static void define_image_type P_ ((struct image_type *type));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7640 static struct image_type *lookup_image_type P_ ((Lisp_Object symbol));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7641 static void image_error P_ ((char *format, Lisp_Object, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7642 static void x_laplace P_ ((struct frame *, struct image *));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7643 static int x_build_heuristic_mask P_ ((struct frame *, struct image *,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7644 Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7645
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7646
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7647 /* Define a new image type from TYPE. This adds a copy of TYPE to
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7648 image_types and adds the symbol *TYPE->type to Vimage_types. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7649
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7650 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7651 define_image_type (type)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7652 struct image_type *type;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7653 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7654 /* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7655 The initialized data segment is read-only. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7656 struct image_type *p = (struct image_type *) xmalloc (sizeof *p);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7657 bcopy (type, p, sizeof *p);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7658 p->next = image_types;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7659 image_types = p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7660 Vimage_types = Fcons (*p->type, Vimage_types);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7661 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7662
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7663
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7664 /* Look up image type SYMBOL, and return a pointer to its image_type
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7665 structure. Value is null if SYMBOL is not a known image type. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7666
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7667 static INLINE struct image_type *
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7668 lookup_image_type (symbol)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7669 Lisp_Object symbol;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7670 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7671 struct image_type *type;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7672
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7673 for (type = image_types; type; type = type->next)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7674 if (EQ (symbol, *type->type))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7675 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7676
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7677 return type;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7678 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7679
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7680
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7681 /* Value is non-zero if OBJECT is a valid Lisp image specification. A
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7682 valid image specification is a list whose car is the symbol
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7683 `image', and whose rest is a property list. The property list must
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7684 contain a value for key `:type'. That value must be the name of a
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7685 supported image type. The rest of the property list depends on the
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7686 image type. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7687
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7688 int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7689 valid_image_p (object)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7690 Lisp_Object object;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7691 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7692 int valid_p = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7693
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7694 if (CONSP (object) && EQ (XCAR (object), Qimage))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7695 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7696 Lisp_Object symbol = Fplist_get (XCDR (object), QCtype);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7697 struct image_type *type = lookup_image_type (symbol);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7698
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7699 if (type)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7700 valid_p = type->valid_p (object);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7701 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7702
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7703 return valid_p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7704 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7705
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7706
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7707 /* Log error message with format string FORMAT and argument ARG.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7708 Signaling an error, e.g. when an image cannot be loaded, is not a
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7709 good idea because this would interrupt redisplay, and the error
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7710 message display would lead to another redisplay. This function
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7711 therefore simply displays a message. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7712
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7713 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7714 image_error (format, arg1, arg2)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7715 char *format;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7716 Lisp_Object arg1, arg2;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7717 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7718 add_to_log (format, arg1, arg2);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7719 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7720
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7721
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7722
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7723 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7724 Image specifications
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7725 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7726
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7727 enum image_value_type
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7728 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7729 IMAGE_DONT_CHECK_VALUE_TYPE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7730 IMAGE_STRING_VALUE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7731 IMAGE_SYMBOL_VALUE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7732 IMAGE_POSITIVE_INTEGER_VALUE,
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7733 IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7734 IMAGE_NON_NEGATIVE_INTEGER_VALUE,
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7735 IMAGE_ASCENT_VALUE,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7736 IMAGE_INTEGER_VALUE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7737 IMAGE_FUNCTION_VALUE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7738 IMAGE_NUMBER_VALUE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7739 IMAGE_BOOL_VALUE
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7740 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7741
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7742 /* Structure used when parsing image specifications. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7743
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7744 struct image_keyword
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7745 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7746 /* Name of keyword. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7747 char *name;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7748
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7749 /* The type of value allowed. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7750 enum image_value_type type;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7751
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7752 /* Non-zero means key must be present. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7753 int mandatory_p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7754
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7755 /* Used to recognize duplicate keywords in a property list. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7756 int count;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7757
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7758 /* The value that was found. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7759 Lisp_Object value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7760 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7761
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7762
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7763 static int parse_image_spec P_ ((Lisp_Object, struct image_keyword *,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7764 int, Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7765 static Lisp_Object image_spec_value P_ ((Lisp_Object, Lisp_Object, int *));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7766
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7767
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7768 /* Parse image spec SPEC according to KEYWORDS. A valid image spec
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7769 has the format (image KEYWORD VALUE ...). One of the keyword/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7770 value pairs must be `:type TYPE'. KEYWORDS is a vector of
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7771 image_keywords structures of size NKEYWORDS describing other
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7772 allowed keyword/value pairs. Value is non-zero if SPEC is valid. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7773
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7774 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7775 parse_image_spec (spec, keywords, nkeywords, type)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7776 Lisp_Object spec;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7777 struct image_keyword *keywords;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7778 int nkeywords;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7779 Lisp_Object type;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7780 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7781 int i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7782 Lisp_Object plist;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7783
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7784 if (!CONSP (spec) || !EQ (XCAR (spec), Qimage))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7785 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7786
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7787 plist = XCDR (spec);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7788 while (CONSP (plist))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7789 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7790 Lisp_Object key, value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7791
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7792 /* First element of a pair must be a symbol. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7793 key = XCAR (plist);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7794 plist = XCDR (plist);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7795 if (!SYMBOLP (key))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7796 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7797
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7798 /* There must follow a value. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7799 if (!CONSP (plist))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7800 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7801 value = XCAR (plist);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7802 plist = XCDR (plist);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7803
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7804 /* Find key in KEYWORDS. Error if not found. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7805 for (i = 0; i < nkeywords; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7806 if (strcmp (keywords[i].name, XSYMBOL (key)->name->data) == 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7807 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7808
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7809 if (i == nkeywords)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7810 continue;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7811
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7812 /* Record that we recognized the keyword. If a keywords
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7813 was found more than once, it's an error. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7814 keywords[i].value = value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7815 ++keywords[i].count;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7816
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7817 if (keywords[i].count > 1)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7818 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7819
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7820 /* Check type of value against allowed type. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7821 switch (keywords[i].type)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7822 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7823 case IMAGE_STRING_VALUE:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7824 if (!STRINGP (value))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7825 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7826 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7827
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7828 case IMAGE_SYMBOL_VALUE:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7829 if (!SYMBOLP (value))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7830 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7831 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7832
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7833 case IMAGE_POSITIVE_INTEGER_VALUE:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7834 if (!INTEGERP (value) || XINT (value) <= 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7835 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7836 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7837
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7838 case IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR:
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7839 if (INTEGERP (value) && XINT (value) >= 0)
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7840 break;
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7841 if (CONSP (value)
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7842 && INTEGERP (XCAR (value)) && INTEGERP (XCDR (value))
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7843 && XINT (XCAR (value)) >= 0 && XINT (XCDR (value)) >= 0)
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7844 break;
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7845 return 0;
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
7846
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7847 case IMAGE_ASCENT_VALUE:
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7848 if (SYMBOLP (value) && EQ (value, Qcenter))
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7849 break;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7850 else if (INTEGERP (value)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7851 && XINT (value) >= 0
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7852 && XINT (value) <= 100)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7853 break;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7854 return 0;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7855
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7856 case IMAGE_NON_NEGATIVE_INTEGER_VALUE:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7857 if (!INTEGERP (value) || XINT (value) < 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7858 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7859 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7860
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7861 case IMAGE_DONT_CHECK_VALUE_TYPE:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7862 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7863
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7864 case IMAGE_FUNCTION_VALUE:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7865 value = indirect_function (value);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7866 if (SUBRP (value)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7867 || COMPILEDP (value)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7868 || (CONSP (value) && EQ (XCAR (value), Qlambda)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7869 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7870 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7871
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7872 case IMAGE_NUMBER_VALUE:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7873 if (!INTEGERP (value) && !FLOATP (value))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7874 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7875 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7876
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7877 case IMAGE_INTEGER_VALUE:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7878 if (!INTEGERP (value))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7879 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7880 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7881
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7882 case IMAGE_BOOL_VALUE:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7883 if (!NILP (value) && !EQ (value, Qt))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7884 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7885 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7886
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7887 default:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7888 abort ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7889 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7890 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7891
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7892 if (EQ (key, QCtype) && !EQ (type, value))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7893 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7894 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7895
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7896 /* Check that all mandatory fields are present. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7897 for (i = 0; i < nkeywords; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7898 if (keywords[i].mandatory_p && keywords[i].count == 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7899 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7900
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7901 return NILP (plist);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7902 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7903
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7904
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7905 /* Return the value of KEY in image specification SPEC. Value is nil
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7906 if KEY is not present in SPEC. if FOUND is not null, set *FOUND
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7907 to 1 if KEY was found in SPEC, set it to 0 otherwise. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7908
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7909 static Lisp_Object
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7910 image_spec_value (spec, key, found)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7911 Lisp_Object spec, key;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7912 int *found;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7913 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7914 Lisp_Object tail;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7915
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7916 xassert (valid_image_p (spec));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7917
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7918 for (tail = XCDR (spec);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7919 CONSP (tail) && CONSP (XCDR (tail));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7920 tail = XCDR (XCDR (tail)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7921 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7922 if (EQ (XCAR (tail), key))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7923 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7924 if (found)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7925 *found = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7926 return XCAR (XCDR (tail));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7927 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7928 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7929
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7930 if (found)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7931 *found = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7932 return Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7933 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7934
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7935
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7936
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7937
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7938 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7939 Image type independent image structures
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7940 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7941
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7942 static struct image *make_image P_ ((Lisp_Object spec, unsigned hash));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7943 static void free_image P_ ((struct frame *f, struct image *img));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7944
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7945
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7946 /* Allocate and return a new image structure for image specification
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7947 SPEC. SPEC has a hash value of HASH. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7948
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7949 static struct image *
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7950 make_image (spec, hash)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7951 Lisp_Object spec;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7952 unsigned hash;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7953 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7954 struct image *img = (struct image *) xmalloc (sizeof *img);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7955
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7956 xassert (valid_image_p (spec));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7957 bzero (img, sizeof *img);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7958 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7959 xassert (img->type != NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7960 img->spec = spec;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7961 img->data.lisp_val = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7962 img->ascent = DEFAULT_IMAGE_ASCENT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7963 img->hash = hash;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7964 return img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7965 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7966
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7967
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7968 /* Free image IMG which was used on frame F, including its resources. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7969
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7970 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7971 free_image (f, img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7972 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7973 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7974 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7975 if (img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7976 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7977 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7978
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7979 /* Remove IMG from the hash table of its cache. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7980 if (img->prev)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7981 img->prev->next = img->next;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7982 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7983 c->buckets[img->hash % IMAGE_CACHE_BUCKETS_SIZE] = img->next;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7984
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7985 if (img->next)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7986 img->next->prev = img->prev;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7987
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7988 c->images[img->id] = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7989
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7990 /* Free resources, then free IMG. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7991 img->type->free (f, img);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7992 xfree (img);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7993 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7994 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7995
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7996
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7997 /* Prepare image IMG for display on frame F. Must be called before
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7998 drawing an image. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7999
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8000 void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8001 prepare_image_for_display (f, img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8002 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8003 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8004 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8005 EMACS_TIME t;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8006
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8007 /* We're about to display IMG, so set its timestamp to `now'. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8008 EMACS_GET_TIME (t);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8009 img->timestamp = EMACS_SECS (t);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8010
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8011 /* If IMG doesn't have a pixmap yet, load it now, using the image
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8012 type dependent loader function. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8013 if (img->pixmap == 0 && !img->load_failed_p)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8014 img->load_failed_p = img->type->load (f, img) == 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8015 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8016
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8017
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8018 /* Value is the number of pixels for the ascent of image IMG when
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8019 drawn in face FACE. */
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8020
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8021 int
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8022 image_ascent (img, face)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8023 struct image *img;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8024 struct face *face;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8025 {
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8026 int height = img->height + img->vmargin;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8027 int ascent;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8028
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8029 if (img->ascent == CENTERED_IMAGE_ASCENT)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8030 {
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8031 if (face->font)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8032 ascent = height / 2 - (FONT_DESCENT(face->font)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8033 - FONT_BASE(face->font)) / 2;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8034 else
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8035 ascent = height / 2;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8036 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8037 else
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8038 ascent = height * img->ascent / 100.0;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8039
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8040 return ascent;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8041 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8042
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8043
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8044
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8045 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8046 Helper functions for X image types
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8047 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8048
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8049 static void x_clear_image P_ ((struct frame *f, struct image *img));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8050 static unsigned long x_alloc_image_color P_ ((struct frame *f,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8051 struct image *img,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8052 Lisp_Object color_name,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8053 unsigned long dflt));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8054
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8055 /* Free X resources of image IMG which is used on frame F. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8056
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8057 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8058 x_clear_image (f, img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8059 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8060 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8061 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
8062 #if 0 /* TODO: W32 image support */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8063
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8064 if (img->pixmap)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8065 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8066 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8067 XFreePixmap (NULL, img->pixmap);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8068 img->pixmap = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8069 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8070 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8071
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8072 if (img->ncolors)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8073 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8074 int class = FRAME_W32_DISPLAY_INFO (f)->visual->class;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8075
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8076 /* If display has an immutable color map, freeing colors is not
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8077 necessary and some servers don't allow it. So don't do it. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8078 if (class != StaticColor
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8079 && class != StaticGray
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8080 && class != TrueColor)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8081 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8082 Colormap cmap;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8083 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8084 cmap = DefaultColormapOfScreen (FRAME_W32_DISPLAY_INFO (f)->screen);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8085 XFreeColors (FRAME_W32_DISPLAY (f), cmap, img->colors,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8086 img->ncolors, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8087 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8088 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8089
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8090 xfree (img->colors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8091 img->colors = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8092 img->ncolors = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8093 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8094 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8095 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8096
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8097
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8098 /* Allocate color COLOR_NAME for image IMG on frame F. If color
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8099 cannot be allocated, use DFLT. Add a newly allocated color to
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8100 IMG->colors, so that it can be freed again. Value is the pixel
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8101 color. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8102
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8103 static unsigned long
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8104 x_alloc_image_color (f, img, color_name, dflt)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8105 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8106 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8107 Lisp_Object color_name;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8108 unsigned long dflt;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8109 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
8110 #if 0 /* TODO: allocing colors. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8111 XColor color;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8112 unsigned long result;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8113
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8114 xassert (STRINGP (color_name));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8115
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8116 if (w32_defined_color (f, XSTRING (color_name)->data, &color, 1))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8117 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8118 /* This isn't called frequently so we get away with simply
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8119 reallocating the color vector to the needed size, here. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8120 ++img->ncolors;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8121 img->colors =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8122 (unsigned long *) xrealloc (img->colors,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8123 img->ncolors * sizeof *img->colors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8124 img->colors[img->ncolors - 1] = color.pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8125 result = color.pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8126 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8127 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8128 result = dflt;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8129 return result;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8130 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8131 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8132 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8133
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8134
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8135
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8136 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8137 Image Cache
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8138 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8139
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8140 static void cache_image P_ ((struct frame *f, struct image *img));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8141
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8142
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8143 /* Return a new, initialized image cache that is allocated from the
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8144 heap. Call free_image_cache to free an image cache. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8145
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8146 struct image_cache *
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8147 make_image_cache ()
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8148 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8149 struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8150 int size;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8151
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8152 bzero (c, sizeof *c);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8153 c->size = 50;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8154 c->images = (struct image **) xmalloc (c->size * sizeof *c->images);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8155 size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8156 c->buckets = (struct image **) xmalloc (size);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8157 bzero (c->buckets, size);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8158 return c;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8159 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8160
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8161
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8162 /* Free image cache of frame F. Be aware that X frames share images
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8163 caches. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8164
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8165 void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8166 free_image_cache (f)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8167 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8168 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8169 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8170 if (c)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8171 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8172 int i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8173
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8174 /* Cache should not be referenced by any frame when freed. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8175 xassert (c->refcount == 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8176
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8177 for (i = 0; i < c->used; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8178 free_image (f, c->images[i]);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8179 xfree (c->images);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8180 xfree (c);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8181 xfree (c->buckets);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8182 FRAME_X_IMAGE_CACHE (f) = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8183 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8184 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8185
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8186
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8187 /* Clear image cache of frame F. FORCE_P non-zero means free all
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8188 images. FORCE_P zero means clear only images that haven't been
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8189 displayed for some time. Should be called from time to time to
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8190 reduce the number of loaded images. If image-eviction-seconds is
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8191 non-nil, this frees images in the cache which weren't displayed for
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8192 at least that many seconds. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8193
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8194 void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8195 clear_image_cache (f, force_p)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8196 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8197 int force_p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8198 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8199 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8200
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8201 if (c && INTEGERP (Vimage_cache_eviction_delay))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8202 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8203 EMACS_TIME t;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8204 unsigned long old;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8205 int i, any_freed_p = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8206
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8207 EMACS_GET_TIME (t);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8208 old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8209
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8210 for (i = 0; i < c->used; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8211 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8212 struct image *img = c->images[i];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8213 if (img != NULL
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8214 && (force_p
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8215 || (img->timestamp > old)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8216 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8217 free_image (f, img);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8218 any_freed_p = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8219 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8220 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8221
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8222 /* We may be clearing the image cache because, for example,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8223 Emacs was iconified for a longer period of time. In that
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8224 case, current matrices may still contain references to
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8225 images freed above. So, clear these matrices. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8226 if (any_freed_p)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8227 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8228 clear_current_matrices (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8229 ++windows_or_buffers_changed;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8230 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8231 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8232 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8233
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8234
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8235 DEFUN ("clear-image-cache", Fclear_image_cache, Sclear_image_cache,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8236 0, 1, 0,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8237 "Clear the image cache of FRAME.\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8238 FRAME nil or omitted means use the selected frame.\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8239 FRAME t means clear the image caches of all frames.")
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8240 (frame)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8241 Lisp_Object frame;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8242 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8243 if (EQ (frame, Qt))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8244 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8245 Lisp_Object tail;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8246
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8247 FOR_EACH_FRAME (tail, frame)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8248 if (FRAME_W32_P (XFRAME (frame)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8249 clear_image_cache (XFRAME (frame), 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8250 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8251 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8252 clear_image_cache (check_x_frame (frame), 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8253
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8254 return Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8255 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8256
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8257
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8258 /* Return the id of image with Lisp specification SPEC on frame F.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8259 SPEC must be a valid Lisp image specification (see valid_image_p). */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8260
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8261 int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8262 lookup_image (f, spec)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8263 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8264 Lisp_Object spec;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8265 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8266 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8267 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8268 int i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8269 unsigned hash;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8270 struct gcpro gcpro1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8271 EMACS_TIME now;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8272
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8273 /* F must be a window-system frame, and SPEC must be a valid image
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8274 specification. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8275 xassert (FRAME_WINDOW_P (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8276 xassert (valid_image_p (spec));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8277
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8278 GCPRO1 (spec);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8279
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8280 /* Look up SPEC in the hash table of the image cache. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8281 hash = sxhash (spec, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8282 i = hash % IMAGE_CACHE_BUCKETS_SIZE;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8283
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8284 for (img = c->buckets[i]; img; img = img->next)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8285 if (img->hash == hash && !NILP (Fequal (img->spec, spec)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8286 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8287
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8288 /* If not found, create a new image and cache it. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8289 if (img == NULL)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8290 {
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8291 BLOCK_INPUT;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8292 img = make_image (spec, hash);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8293 cache_image (f, img);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8294 img->load_failed_p = img->type->load (f, img) == 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8295
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8296 /* If we can't load the image, and we don't have a width and
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8297 height, use some arbitrary width and height so that we can
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8298 draw a rectangle for it. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8299 if (img->load_failed_p)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8300 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8301 Lisp_Object value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8302
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8303 value = image_spec_value (spec, QCwidth, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8304 img->width = (INTEGERP (value)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8305 ? XFASTINT (value) : DEFAULT_IMAGE_WIDTH);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8306 value = image_spec_value (spec, QCheight, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8307 img->height = (INTEGERP (value)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8308 ? XFASTINT (value) : DEFAULT_IMAGE_HEIGHT);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8309 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8310 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8311 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8312 /* Handle image type independent image attributes
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8313 `:ascent PERCENT', `:margin MARGIN', `:relief RELIEF'. */
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8314 Lisp_Object ascent, margin, relief;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8315
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8316 ascent = image_spec_value (spec, QCascent, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8317 if (INTEGERP (ascent))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8318 img->ascent = XFASTINT (ascent);
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8319 else if (EQ (ascent, Qcenter))
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8320 img->ascent = CENTERED_IMAGE_ASCENT;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8321
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8322 margin = image_spec_value (spec, QCmargin, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8323 if (INTEGERP (margin) && XINT (margin) >= 0)
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8324 img->vmargin = img->hmargin = XFASTINT (margin);
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8325 else if (CONSP (margin) && INTEGERP (XCAR (margin))
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8326 && INTEGERP (XCDR (margin)))
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8327 {
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8328 if (XINT (XCAR (margin)) > 0)
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8329 img->hmargin = XFASTINT (XCAR (margin));
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8330 if (XINT (XCDR (margin)) > 0)
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8331 img->vmargin = XFASTINT (XCDR (margin));
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8332 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8333
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8334 relief = image_spec_value (spec, QCrelief, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8335 if (INTEGERP (relief))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8336 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8337 img->relief = XINT (relief);
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8338 img->hmargin += abs (img->relief);
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8339 img->vmargin += abs (img->relief);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8340 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8341
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8342 #if 0 /* TODO: image mask and algorithm. */
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8343 /* Manipulation of the image's mask. */
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8344 if (img->pixmap)
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8345 {
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8346 /* `:heuristic-mask t'
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8347 `:mask heuristic'
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8348 means build a mask heuristically.
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8349 `:heuristic-mask (R G B)'
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8350 `:mask (heuristic (R G B))'
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8351 means build a mask from color (R G B) in the
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8352 image.
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8353 `:mask nil'
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8354 means remove a mask, if any. */
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8355
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8356 Lisp_Object mask;
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8357
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8358 mask = image_spec_value (spec, QCheuristic_mask, NULL);
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8359 if (!NILP (mask))
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8360 x_build_heuristic_mask (f, img, mask);
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8361 else
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8362 {
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8363 int found_p;
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8364
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8365 mask = image_spec_value (spec, QCmask, &found_p);
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8366
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8367 if (EQ (mask, Qheuristic))
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8368 x_build_heuristic_mask (f, img, Qt);
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8369 else if (CONSP (mask)
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8370 && EQ (XCAR (mask), Qheuristic))
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8371 {
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8372 if (CONSP (XCDR (mask)))
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8373 x_build_heuristic_mask (f, img, XCAR (XCDR (mask)));
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8374 else
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8375 x_build_heuristic_mask (f, img, XCDR (mask));
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8376 }
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8377 else if (NILP (mask) && found_p && img->mask)
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8378 {
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8379 XFreePixmap (FRAME_X_DISPLAY (f), img->mask);
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8380 img->mask = None;
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8381 }
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8382 }
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8383 }
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8384
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8385 /* Should we apply an image transformation algorithm? */
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8386 if (img->pixmap)
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8387 {
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
8388 Lisp_Object conversion;
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
8389
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
8390 algorithm = image_spec_value (spec, QCconversion, NULL);
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
8391 if (EQ (conversion, Qdisabled))
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8392 x_disable_image (f, img);
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
8393 else if (EQ (conversion, Qlaplace))
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8394 x_laplace (f, img);
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
8395 else if (EQ (conversion, Qemboss))
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8396 x_emboss (f, img);
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
8397 else if (CONSP (conversion)
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
8398 && EQ (XCAR (conversion), Qedge_detection))
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8399 {
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8400 Lisp_Object tem;
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
8401 tem = XCDR (conversion);
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8402 if (CONSP (tem))
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8403 x_edge_detection (f, img,
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8404 Fplist_get (tem, QCmatrix),
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8405 Fplist_get (tem, QCcolor_adjustment));
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8406 }
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8407 }
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8408 #endif /* TODO. */
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8409 }
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8410 UNBLOCK_INPUT;
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8411 xassert (!interrupt_input_blocked);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8412 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8413
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8414 /* We're using IMG, so set its timestamp to `now'. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8415 EMACS_GET_TIME (now);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8416 img->timestamp = EMACS_SECS (now);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8417
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8418 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8419
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8420 /* Value is the image id. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8421 return img->id;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8422 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8423
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8424
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8425 /* Cache image IMG in the image cache of frame F. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8426
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8427 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8428 cache_image (f, img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8429 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8430 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8431 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8432 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8433 int i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8434
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8435 /* Find a free slot in c->images. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8436 for (i = 0; i < c->used; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8437 if (c->images[i] == NULL)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8438 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8439
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8440 /* If no free slot found, maybe enlarge c->images. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8441 if (i == c->used && c->used == c->size)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8442 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8443 c->size *= 2;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8444 c->images = (struct image **) xrealloc (c->images,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8445 c->size * sizeof *c->images);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8446 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8447
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8448 /* Add IMG to c->images, and assign IMG an id. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8449 c->images[i] = img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8450 img->id = i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8451 if (i == c->used)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8452 ++c->used;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8453
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8454 /* Add IMG to the cache's hash table. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8455 i = img->hash % IMAGE_CACHE_BUCKETS_SIZE;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8456 img->next = c->buckets[i];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8457 if (img->next)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8458 img->next->prev = img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8459 img->prev = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8460 c->buckets[i] = img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8461 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8462
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8463
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8464 /* Call FN on every image in the image cache of frame F. Used to mark
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8465 Lisp Objects in the image cache. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8466
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8467 void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8468 forall_images_in_image_cache (f, fn)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8469 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8470 void (*fn) P_ ((struct image *img));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8471 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8472 if (FRAME_LIVE_P (f) && FRAME_W32_P (f))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8473 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8474 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8475 if (c)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8476 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8477 int i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8478 for (i = 0; i < c->used; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8479 if (c->images[i])
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8480 fn (c->images[i]);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8481 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8482 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8483 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8484
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8485
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8486
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8487 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8488 W32 support code
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8489 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8490
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
8491 #if 0 /* TODO: W32 specific image code. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8492
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8493 static int x_create_x_image_and_pixmap P_ ((struct frame *, int, int, int,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8494 XImage **, Pixmap *));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8495 static void x_destroy_x_image P_ ((XImage *));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8496 static void x_put_x_image P_ ((struct frame *, XImage *, Pixmap, int, int));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8497
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8498
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8499 /* Create an XImage and a pixmap of size WIDTH x HEIGHT for use on
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8500 frame F. Set *XIMG and *PIXMAP to the XImage and Pixmap created.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8501 Set (*XIMG)->data to a raster of WIDTH x HEIGHT pixels allocated
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8502 via xmalloc. Print error messages via image_error if an error
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8503 occurs. Value is non-zero if successful. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8504
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8505 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8506 x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8507 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8508 int width, height, depth;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8509 XImage **ximg;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8510 Pixmap *pixmap;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8511 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
8512 #if 0 /* TODO: Image support for W32 */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8513 Display *display = FRAME_W32_DISPLAY (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8514 Screen *screen = FRAME_X_SCREEN (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8515 Window window = FRAME_W32_WINDOW (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8516
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8517 xassert (interrupt_input_blocked);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8518
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8519 if (depth <= 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8520 depth = DefaultDepthOfScreen (screen);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8521 *ximg = XCreateImage (display, DefaultVisualOfScreen (screen),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8522 depth, ZPixmap, 0, NULL, width, height,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8523 depth > 16 ? 32 : depth > 8 ? 16 : 8, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8524 if (*ximg == NULL)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8525 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8526 image_error ("Unable to allocate X image", Qnil, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8527 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8528 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8529
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8530 /* Allocate image raster. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8531 (*ximg)->data = (char *) xmalloc ((*ximg)->bytes_per_line * height);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8532
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8533 /* Allocate a pixmap of the same size. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8534 *pixmap = XCreatePixmap (display, window, width, height, depth);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8535 if (*pixmap == 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8536 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8537 x_destroy_x_image (*ximg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8538 *ximg = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8539 image_error ("Unable to create X pixmap", Qnil, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8540 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8541 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8542 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8543 return 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8544 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8545
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8546
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8547 /* Destroy XImage XIMG. Free XIMG->data. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8548
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8549 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8550 x_destroy_x_image (ximg)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8551 XImage *ximg;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8552 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8553 xassert (interrupt_input_blocked);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8554 if (ximg)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8555 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8556 xfree (ximg->data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8557 ximg->data = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8558 XDestroyImage (ximg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8559 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8560 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8561
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8562
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8563 /* Put XImage XIMG into pixmap PIXMAP on frame F. WIDTH and HEIGHT
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8564 are width and height of both the image and pixmap. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8565
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8566 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8567 x_put_x_image (f, ximg, pixmap, width, height)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8568 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8569 XImage *ximg;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8570 Pixmap pixmap;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8571 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8572 GC gc;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8573
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8574 xassert (interrupt_input_blocked);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8575 gc = XCreateGC (NULL, pixmap, 0, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8576 XPutImage (NULL, pixmap, gc, ximg, 0, 0, 0, 0, width, height);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8577 XFreeGC (NULL, gc);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8578 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8579
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8580 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8581
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8582
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8583 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8584 Searching files
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8585 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8586
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8587 static Lisp_Object x_find_image_file P_ ((Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8588
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8589 /* Find image file FILE. Look in data-directory, then
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8590 x-bitmap-file-path. Value is the full name of the file found, or
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8591 nil if not found. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8592
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8593 static Lisp_Object
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8594 x_find_image_file (file)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8595 Lisp_Object file;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8596 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8597 Lisp_Object file_found, search_path;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8598 struct gcpro gcpro1, gcpro2;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8599 int fd;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8600
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8601 file_found = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8602 search_path = Fcons (Vdata_directory, Vx_bitmap_file_path);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8603 GCPRO2 (file_found, search_path);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8604
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8605 /* Try to find FILE in data-directory, then x-bitmap-file-path. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8606 fd = openp (search_path, file, "", &file_found, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8607
33443
2c60aa5cd386 (x_create_bitmap_from_file, x_find_image_file): Use new openp return protocol.
Miles Bader <miles@gnu.org>
parents: 33387
diff changeset
8608 if (fd == -1)
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8609 file_found = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8610 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8611 close (fd);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8612
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8613 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8614 return file_found;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8615 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8616
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8617
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8618
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8619 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8620 XBM images
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8621 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8622
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8623 static int xbm_load P_ ((struct frame *f, struct image *img));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8624 static int xbm_load_image_from_file P_ ((struct frame *f, struct image *img,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8625 Lisp_Object file));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8626 static int xbm_image_p P_ ((Lisp_Object object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8627 static int xbm_read_bitmap_file_data P_ ((char *, int *, int *,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8628 unsigned char **));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8629
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8630
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8631 /* Indices of image specification fields in xbm_format, below. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8632
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8633 enum xbm_keyword_index
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8634 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8635 XBM_TYPE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8636 XBM_FILE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8637 XBM_WIDTH,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8638 XBM_HEIGHT,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8639 XBM_DATA,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8640 XBM_FOREGROUND,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8641 XBM_BACKGROUND,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8642 XBM_ASCENT,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8643 XBM_MARGIN,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8644 XBM_RELIEF,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8645 XBM_ALGORITHM,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8646 XBM_HEURISTIC_MASK,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8647 XBM_LAST
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8648 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8649
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8650 /* Vector of image_keyword structures describing the format
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8651 of valid XBM image specifications. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8652
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8653 static struct image_keyword xbm_format[XBM_LAST] =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8654 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8655 {":type", IMAGE_SYMBOL_VALUE, 1},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8656 {":file", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8657 {":width", IMAGE_POSITIVE_INTEGER_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8658 {":height", IMAGE_POSITIVE_INTEGER_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8659 {":data", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8660 {":foreground", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8661 {":background", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8662 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
8663 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8664 {":relief", IMAGE_INTEGER_VALUE, 0},
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
8665 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8666 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8667 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8668
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8669 /* Structure describing the image type XBM. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8670
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8671 static struct image_type xbm_type =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8672 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8673 &Qxbm,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8674 xbm_image_p,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8675 xbm_load,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8676 x_clear_image,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8677 NULL
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8678 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8679
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8680 /* Tokens returned from xbm_scan. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8681
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8682 enum xbm_token
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8683 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8684 XBM_TK_IDENT = 256,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8685 XBM_TK_NUMBER
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8686 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8687
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8688
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8689 /* Return non-zero if OBJECT is a valid XBM-type image specification.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8690 A valid specification is a list starting with the symbol `image'
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8691 The rest of the list is a property list which must contain an
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8692 entry `:type xbm..
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8693
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8694 If the specification specifies a file to load, it must contain
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8695 an entry `:file FILENAME' where FILENAME is a string.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8696
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8697 If the specification is for a bitmap loaded from memory it must
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8698 contain `:width WIDTH', `:height HEIGHT', and `:data DATA', where
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8699 WIDTH and HEIGHT are integers > 0. DATA may be:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8700
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8701 1. a string large enough to hold the bitmap data, i.e. it must
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8702 have a size >= (WIDTH + 7) / 8 * HEIGHT
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8703
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8704 2. a bool-vector of size >= WIDTH * HEIGHT
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8705
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8706 3. a vector of strings or bool-vectors, one for each line of the
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8707 bitmap.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8708
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8709 Both the file and data forms may contain the additional entries
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8710 `:background COLOR' and `:foreground COLOR'. If not present,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8711 foreground and background of the frame on which the image is
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8712 displayed, is used. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8713
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8714 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8715 xbm_image_p (object)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8716 Lisp_Object object;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8717 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8718 struct image_keyword kw[XBM_LAST];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8719
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8720 bcopy (xbm_format, kw, sizeof kw);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8721 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8722 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8723
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8724 xassert (EQ (kw[XBM_TYPE].value, Qxbm));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8725
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8726 if (kw[XBM_FILE].count)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8727 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8728 if (kw[XBM_WIDTH].count || kw[XBM_HEIGHT].count || kw[XBM_DATA].count)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8729 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8730 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8731 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8732 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8733 Lisp_Object data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8734 int width, height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8735
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8736 /* Entries for `:width', `:height' and `:data' must be present. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8737 if (!kw[XBM_WIDTH].count
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8738 || !kw[XBM_HEIGHT].count
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8739 || !kw[XBM_DATA].count)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8740 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8741
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8742 data = kw[XBM_DATA].value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8743 width = XFASTINT (kw[XBM_WIDTH].value);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8744 height = XFASTINT (kw[XBM_HEIGHT].value);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8745
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8746 /* Check type of data, and width and height against contents of
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8747 data. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8748 if (VECTORP (data))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8749 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8750 int i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8751
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8752 /* Number of elements of the vector must be >= height. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8753 if (XVECTOR (data)->size < height)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8754 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8755
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8756 /* Each string or bool-vector in data must be large enough
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8757 for one line of the image. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8758 for (i = 0; i < height; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8759 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8760 Lisp_Object elt = XVECTOR (data)->contents[i];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8761
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8762 if (STRINGP (elt))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8763 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8764 if (XSTRING (elt)->size
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8765 < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8766 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8767 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8768 else if (BOOL_VECTOR_P (elt))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8769 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8770 if (XBOOL_VECTOR (elt)->size < width)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8771 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8772 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8773 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8774 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8775 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8776 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8777 else if (STRINGP (data))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8778 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8779 if (XSTRING (data)->size
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8780 < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR * height)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8781 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8782 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8783 else if (BOOL_VECTOR_P (data))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8784 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8785 if (XBOOL_VECTOR (data)->size < width * height)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8786 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8787 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8788 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8789 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8790 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8791
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8792 /* Baseline must be a value between 0 and 100 (a percentage). */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8793 if (kw[XBM_ASCENT].count
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8794 && XFASTINT (kw[XBM_ASCENT].value) > 100)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8795 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8796
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8797 return 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8798 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8799
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8800
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8801 /* Scan a bitmap file. FP is the stream to read from. Value is
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8802 either an enumerator from enum xbm_token, or a character for a
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8803 single-character token, or 0 at end of file. If scanning an
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8804 identifier, store the lexeme of the identifier in SVAL. If
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8805 scanning a number, store its value in *IVAL. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8806
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8807 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8808 xbm_scan (fp, sval, ival)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8809 FILE *fp;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8810 char *sval;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8811 int *ival;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8812 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8813 int c;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8814
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8815 /* Skip white space. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8816 while ((c = fgetc (fp)) != EOF && isspace (c))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8817 ;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8818
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8819 if (c == EOF)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8820 c = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8821 else if (isdigit (c))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8822 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8823 int value = 0, digit;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8824
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8825 if (c == '0')
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8826 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8827 c = fgetc (fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8828 if (c == 'x' || c == 'X')
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8829 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8830 while ((c = fgetc (fp)) != EOF)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8831 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8832 if (isdigit (c))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8833 digit = c - '0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8834 else if (c >= 'a' && c <= 'f')
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8835 digit = c - 'a' + 10;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8836 else if (c >= 'A' && c <= 'F')
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8837 digit = c - 'A' + 10;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8838 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8839 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8840 value = 16 * value + digit;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8841 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8842 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8843 else if (isdigit (c))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8844 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8845 value = c - '0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8846 while ((c = fgetc (fp)) != EOF
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8847 && isdigit (c))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8848 value = 8 * value + c - '0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8849 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8850 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8851 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8852 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8853 value = c - '0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8854 while ((c = fgetc (fp)) != EOF
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8855 && isdigit (c))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8856 value = 10 * value + c - '0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8857 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8858
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8859 if (c != EOF)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8860 ungetc (c, fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8861 *ival = value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8862 c = XBM_TK_NUMBER;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8863 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8864 else if (isalpha (c) || c == '_')
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8865 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8866 *sval++ = c;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8867 while ((c = fgetc (fp)) != EOF
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8868 && (isalnum (c) || c == '_'))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8869 *sval++ = c;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8870 *sval = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8871 if (c != EOF)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8872 ungetc (c, fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8873 c = XBM_TK_IDENT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8874 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8875
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8876 return c;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8877 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8878
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8879
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8880 /* Replacement for XReadBitmapFileData which isn't available under old
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8881 X versions. FILE is the name of the bitmap file to read. Set
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8882 *WIDTH and *HEIGHT to the width and height of the image. Return in
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8883 *DATA the bitmap data allocated with xmalloc. Value is non-zero if
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8884 successful. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8885
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8886 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8887 xbm_read_bitmap_file_data (file, width, height, data)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8888 char *file;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8889 int *width, *height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8890 unsigned char **data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8891 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8892 FILE *fp;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8893 char buffer[BUFSIZ];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8894 int padding_p = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8895 int v10 = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8896 int bytes_per_line, i, nbytes;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8897 unsigned char *p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8898 int value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8899 int LA1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8900
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8901 #define match() \
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8902 LA1 = xbm_scan (fp, buffer, &value)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8903
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8904 #define expect(TOKEN) \
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8905 if (LA1 != (TOKEN)) \
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8906 goto failure; \
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8907 else \
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8908 match ()
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8909
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8910 #define expect_ident(IDENT) \
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8911 if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8912 match (); \
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8913 else \
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8914 goto failure
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8915
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8916 fp = fopen (file, "r");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8917 if (fp == NULL)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8918 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8919
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8920 *width = *height = -1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8921 *data = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8922 LA1 = xbm_scan (fp, buffer, &value);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8923
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8924 /* Parse defines for width, height and hot-spots. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8925 while (LA1 == '#')
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8926 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8927 match ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8928 expect_ident ("define");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8929 expect (XBM_TK_IDENT);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8930
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8931 if (LA1 == XBM_TK_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8932 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8933 char *p = strrchr (buffer, '_');
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8934 p = p ? p + 1 : buffer;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8935 if (strcmp (p, "width") == 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8936 *width = value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8937 else if (strcmp (p, "height") == 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8938 *height = value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8939 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8940 expect (XBM_TK_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8941 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8942
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8943 if (*width < 0 || *height < 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8944 goto failure;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8945
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8946 /* Parse bits. Must start with `static'. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8947 expect_ident ("static");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8948 if (LA1 == XBM_TK_IDENT)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8949 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8950 if (strcmp (buffer, "unsigned") == 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8951 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8952 match ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8953 expect_ident ("char");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8954 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8955 else if (strcmp (buffer, "short") == 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8956 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8957 match ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8958 v10 = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8959 if (*width % 16 && *width % 16 < 9)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8960 padding_p = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8961 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8962 else if (strcmp (buffer, "char") == 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8963 match ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8964 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8965 goto failure;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8966 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8967 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8968 goto failure;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8969
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8970 expect (XBM_TK_IDENT);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8971 expect ('[');
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8972 expect (']');
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8973 expect ('=');
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8974 expect ('{');
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8975
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8976 bytes_per_line = (*width + 7) / 8 + padding_p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8977 nbytes = bytes_per_line * *height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8978 p = *data = (char *) xmalloc (nbytes);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8979
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8980 if (v10)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8981 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8982
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8983 for (i = 0; i < nbytes; i += 2)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8984 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8985 int val = value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8986 expect (XBM_TK_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8987
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8988 *p++ = val;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8989 if (!padding_p || ((i + 2) % bytes_per_line))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8990 *p++ = value >> 8;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8991
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8992 if (LA1 == ',' || LA1 == '}')
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8993 match ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8994 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8995 goto failure;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8996 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8997 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8998 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8999 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9000 for (i = 0; i < nbytes; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9001 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9002 int val = value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9003 expect (XBM_TK_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9004
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9005 *p++ = val;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9006
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9007 if (LA1 == ',' || LA1 == '}')
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9008 match ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9009 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9010 goto failure;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9011 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9012 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9013
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9014 fclose (fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9015 return 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9016
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9017 failure:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9018
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9019 fclose (fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9020 if (*data)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9021 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9022 xfree (*data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9023 *data = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9024 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9025 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9026
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9027 #undef match
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9028 #undef expect
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9029 #undef expect_ident
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9030 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9031
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9032
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9033 /* Load XBM image IMG which will be displayed on frame F from file
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9034 SPECIFIED_FILE. Value is non-zero if successful. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9035
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9036 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9037 xbm_load_image_from_file (f, img, specified_file)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9038 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9039 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9040 Lisp_Object specified_file;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9041 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9042 int rc;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9043 unsigned char *data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9044 int success_p = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9045 Lisp_Object file;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9046 struct gcpro gcpro1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9047
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9048 xassert (STRINGP (specified_file));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9049 file = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9050 GCPRO1 (file);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9051
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9052 file = x_find_image_file (specified_file);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9053 if (!STRINGP (file))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9054 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9055 image_error ("Cannot find image file `%s'", specified_file, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9056 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9057 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9058 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9059
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9060 rc = xbm_read_bitmap_file_data (XSTRING (file)->data, &img->width,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9061 &img->height, &data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9062 if (rc)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9063 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9064 int depth = one_w32_display_info.n_cbits;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9065 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9066 unsigned long background = FRAME_BACKGROUND_PIXEL (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9067 Lisp_Object value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9068
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9069 xassert (img->width > 0 && img->height > 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9070
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9071 /* Get foreground and background colors, maybe allocate colors. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9072 value = image_spec_value (img->spec, QCforeground, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9073 if (!NILP (value))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9074 foreground = x_alloc_image_color (f, img, value, foreground);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9075
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9076 value = image_spec_value (img->spec, QCbackground, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9077 if (!NILP (value))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9078 background = x_alloc_image_color (f, img, value, background);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9079
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
9080 #if 0 /* TODO : Port image display to W32 */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9081 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9082 img->pixmap
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9083 = XCreatePixmapFromBitmapData (FRAME_W32_DISPLAY (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9084 FRAME_W32_WINDOW (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9085 data,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9086 img->width, img->height,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9087 foreground, background,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9088 depth);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9089 xfree (data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9090
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9091 if (img->pixmap == 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9092 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9093 x_clear_image (f, img);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9094 image_error ("Unable to create X pixmap for `%s'", file, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9095 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9096 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9097 success_p = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9098
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9099 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9100 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9101 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9102 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9103 image_error ("Error loading XBM image `%s'", img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9104
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9105 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9106 return success_p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9107 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9108
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9109
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9110 /* Fill image IMG which is used on frame F with pixmap data. Value is
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9111 non-zero if successful. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9112
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9113 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9114 xbm_load (f, img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9115 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9116 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9117 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9118 int success_p = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9119 Lisp_Object file_name;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9120
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9121 xassert (xbm_image_p (img->spec));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9122
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9123 /* If IMG->spec specifies a file name, create a non-file spec from it. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9124 file_name = image_spec_value (img->spec, QCfile, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9125 if (STRINGP (file_name))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9126 success_p = xbm_load_image_from_file (f, img, file_name);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9127 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9128 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9129 struct image_keyword fmt[XBM_LAST];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9130 Lisp_Object data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9131 int depth;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9132 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9133 unsigned long background = FRAME_BACKGROUND_PIXEL (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9134 char *bits;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9135 int parsed_p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9136
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9137 /* Parse the list specification. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9138 bcopy (xbm_format, fmt, sizeof fmt);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9139 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9140 xassert (parsed_p);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9141
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9142 /* Get specified width, and height. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9143 img->width = XFASTINT (fmt[XBM_WIDTH].value);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9144 img->height = XFASTINT (fmt[XBM_HEIGHT].value);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9145 xassert (img->width > 0 && img->height > 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9146
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9147 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9148
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9149 if (fmt[XBM_ASCENT].count)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9150 img->ascent = XFASTINT (fmt[XBM_ASCENT].value);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9151
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9152 /* Get foreground and background colors, maybe allocate colors. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9153 if (fmt[XBM_FOREGROUND].count)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9154 foreground = x_alloc_image_color (f, img, fmt[XBM_FOREGROUND].value,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9155 foreground);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9156 if (fmt[XBM_BACKGROUND].count)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9157 background = x_alloc_image_color (f, img, fmt[XBM_BACKGROUND].value,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9158 background);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9159
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9160 /* Set bits to the bitmap image data. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9161 data = fmt[XBM_DATA].value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9162 if (VECTORP (data))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9163 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9164 int i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9165 char *p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9166 int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9167
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9168 p = bits = (char *) alloca (nbytes * img->height);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9169 for (i = 0; i < img->height; ++i, p += nbytes)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9170 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9171 Lisp_Object line = XVECTOR (data)->contents[i];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9172 if (STRINGP (line))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9173 bcopy (XSTRING (line)->data, p, nbytes);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9174 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9175 bcopy (XBOOL_VECTOR (line)->data, p, nbytes);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9176 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9177 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9178 else if (STRINGP (data))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9179 bits = XSTRING (data)->data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9180 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9181 bits = XBOOL_VECTOR (data)->data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9182
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
9183 #if 0 /* TODO : W32 XPM code */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9184 /* Create the pixmap. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9185 depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9186 img->pixmap
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9187 = XCreatePixmapFromBitmapData (FRAME_W32_DISPLAY (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9188 FRAME_W32_WINDOW (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9189 bits,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9190 img->width, img->height,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9191 foreground, background,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9192 depth);
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
9193 #endif /* TODO */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9194
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9195 if (img->pixmap)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9196 success_p = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9197 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9198 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9199 image_error ("Unable to create pixmap for XBM image `%s'",
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9200 img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9201 x_clear_image (f, img);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9202 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9203
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9204 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9205 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9206
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9207 return success_p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9208 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9209
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9210
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9211
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9212 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9213 XPM images
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9214 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9215
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9216 #if HAVE_XPM
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9217
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9218 static int xpm_image_p P_ ((Lisp_Object object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9219 static int xpm_load P_ ((struct frame *f, struct image *img));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9220 static int xpm_valid_color_symbols_p P_ ((Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9221
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9222 #include "X11/xpm.h"
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9223
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9224 /* The symbol `xpm' identifying XPM-format images. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9225
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9226 Lisp_Object Qxpm;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9227
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9228 /* Indices of image specification fields in xpm_format, below. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9229
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9230 enum xpm_keyword_index
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9231 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9232 XPM_TYPE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9233 XPM_FILE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9234 XPM_DATA,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9235 XPM_ASCENT,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9236 XPM_MARGIN,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9237 XPM_RELIEF,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9238 XPM_ALGORITHM,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9239 XPM_HEURISTIC_MASK,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9240 XPM_COLOR_SYMBOLS,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9241 XPM_LAST
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9242 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9243
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9244 /* Vector of image_keyword structures describing the format
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9245 of valid XPM image specifications. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9246
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9247 static struct image_keyword xpm_format[XPM_LAST] =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9248 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9249 {":type", IMAGE_SYMBOL_VALUE, 1},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9250 {":file", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9251 {":data", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9252 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
9253 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9254 {":relief", IMAGE_INTEGER_VALUE, 0},
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
9255 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9256 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9257 {":color-symbols", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9258 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9259
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9260 /* Structure describing the image type XBM. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9261
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9262 static struct image_type xpm_type =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9263 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9264 &Qxpm,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9265 xpm_image_p,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9266 xpm_load,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9267 x_clear_image,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9268 NULL
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9269 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9270
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9271
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9272 /* Value is non-zero if COLOR_SYMBOLS is a valid color symbols list
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9273 for XPM images. Such a list must consist of conses whose car and
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9274 cdr are strings. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9275
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9276 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9277 xpm_valid_color_symbols_p (color_symbols)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9278 Lisp_Object color_symbols;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9279 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9280 while (CONSP (color_symbols))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9281 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9282 Lisp_Object sym = XCAR (color_symbols);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9283 if (!CONSP (sym)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9284 || !STRINGP (XCAR (sym))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9285 || !STRINGP (XCDR (sym)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9286 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9287 color_symbols = XCDR (color_symbols);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9288 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9289
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9290 return NILP (color_symbols);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9291 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9292
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9293
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9294 /* Value is non-zero if OBJECT is a valid XPM image specification. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9295
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9296 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9297 xpm_image_p (object)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9298 Lisp_Object object;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9299 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9300 struct image_keyword fmt[XPM_LAST];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9301 bcopy (xpm_format, fmt, sizeof fmt);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9302 return (parse_image_spec (object, fmt, XPM_LAST, Qxpm)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9303 /* Either `:file' or `:data' must be present. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9304 && fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9305 /* Either no `:color-symbols' or it's a list of conses
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9306 whose car and cdr are strings. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9307 && (fmt[XPM_COLOR_SYMBOLS].count == 0
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9308 || xpm_valid_color_symbols_p (fmt[XPM_COLOR_SYMBOLS].value))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9309 && (fmt[XPM_ASCENT].count == 0
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9310 || XFASTINT (fmt[XPM_ASCENT].value) < 100));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9311 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9312
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9313
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9314 /* Load image IMG which will be displayed on frame F. Value is
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9315 non-zero if successful. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9316
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9317 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9318 xpm_load (f, img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9319 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9320 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9321 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9322 int rc, i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9323 XpmAttributes attrs;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9324 Lisp_Object specified_file, color_symbols;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9325
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9326 /* Configure the XPM lib. Use the visual of frame F. Allocate
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9327 close colors. Return colors allocated. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9328 bzero (&attrs, sizeof attrs);
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
9329 attrs.visual = FRAME_X_VISUAL (f);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
9330 attrs.colormap = FRAME_X_COLORMAP (f);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9331 attrs.valuemask |= XpmVisual;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
9332 attrs.valuemask |= XpmColormap;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9333 attrs.valuemask |= XpmReturnAllocPixels;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
9334 #ifdef XpmAllocCloseColors
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9335 attrs.alloc_close_colors = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9336 attrs.valuemask |= XpmAllocCloseColors;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
9337 #else
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
9338 attrs.closeness = 600;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
9339 attrs.valuemask |= XpmCloseness;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
9340 #endif
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9341
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9342 /* If image specification contains symbolic color definitions, add
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9343 these to `attrs'. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9344 color_symbols = image_spec_value (img->spec, QCcolor_symbols, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9345 if (CONSP (color_symbols))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9346 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9347 Lisp_Object tail;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9348 XpmColorSymbol *xpm_syms;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9349 int i, size;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9350
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9351 attrs.valuemask |= XpmColorSymbols;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9352
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9353 /* Count number of symbols. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9354 attrs.numsymbols = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9355 for (tail = color_symbols; CONSP (tail); tail = XCDR (tail))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9356 ++attrs.numsymbols;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9357
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9358 /* Allocate an XpmColorSymbol array. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9359 size = attrs.numsymbols * sizeof *xpm_syms;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9360 xpm_syms = (XpmColorSymbol *) alloca (size);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9361 bzero (xpm_syms, size);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9362 attrs.colorsymbols = xpm_syms;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9363
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9364 /* Fill the color symbol array. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9365 for (tail = color_symbols, i = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9366 CONSP (tail);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9367 ++i, tail = XCDR (tail))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9368 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9369 Lisp_Object name = XCAR (XCAR (tail));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9370 Lisp_Object color = XCDR (XCAR (tail));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9371 xpm_syms[i].name = (char *) alloca (XSTRING (name)->size + 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9372 strcpy (xpm_syms[i].name, XSTRING (name)->data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9373 xpm_syms[i].value = (char *) alloca (XSTRING (color)->size + 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9374 strcpy (xpm_syms[i].value, XSTRING (color)->data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9375 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9376 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9377
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9378 /* Create a pixmap for the image, either from a file, or from a
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9379 string buffer containing data in the same format as an XPM file. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9380 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9381 specified_file = image_spec_value (img->spec, QCfile, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9382 if (STRINGP (specified_file))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9383 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9384 Lisp_Object file = x_find_image_file (specified_file);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9385 if (!STRINGP (file))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9386 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9387 image_error ("Cannot find image file `%s'", specified_file, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9388 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9389 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9390 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9391
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9392 rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9393 XSTRING (file)->data, &img->pixmap, &img->mask,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9394 &attrs);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9395 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9396 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9397 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9398 Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9399 rc = XpmCreatePixmapFromBuffer (NULL, FRAME_W32_WINDOW (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9400 XSTRING (buffer)->data,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9401 &img->pixmap, &img->mask,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9402 &attrs);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9403 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9404 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9405
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9406 if (rc == XpmSuccess)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9407 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9408 /* Remember allocated colors. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9409 img->ncolors = attrs.nalloc_pixels;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9410 img->colors = (unsigned long *) xmalloc (img->ncolors
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9411 * sizeof *img->colors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9412 for (i = 0; i < attrs.nalloc_pixels; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9413 img->colors[i] = attrs.alloc_pixels[i];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9414
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9415 img->width = attrs.width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9416 img->height = attrs.height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9417 xassert (img->width > 0 && img->height > 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9418
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9419 /* The call to XpmFreeAttributes below frees attrs.alloc_pixels. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9420 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9421 XpmFreeAttributes (&attrs);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9422 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9423 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9424 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9425 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9426 switch (rc)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9427 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9428 case XpmOpenFailed:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9429 image_error ("Error opening XPM file (%s)", img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9430 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9431
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9432 case XpmFileInvalid:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9433 image_error ("Invalid XPM file (%s)", img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9434 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9435
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9436 case XpmNoMemory:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9437 image_error ("Out of memory (%s)", img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9438 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9439
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9440 case XpmColorFailed:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9441 image_error ("Color allocation error (%s)", img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9442 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9443
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9444 default:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9445 image_error ("Unknown error (%s)", img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9446 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9447 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9448 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9449
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9450 return rc == XpmSuccess;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9451 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9452
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9453 #endif /* HAVE_XPM != 0 */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9454
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9455
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
9456 #if 0 /* TODO : Color tables on W32. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9457 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9458 Color table
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9459 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9460
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9461 /* An entry in the color table mapping an RGB color to a pixel color. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9462
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9463 struct ct_color
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9464 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9465 int r, g, b;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9466 unsigned long pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9467
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9468 /* Next in color table collision list. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9469 struct ct_color *next;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9470 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9471
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9472 /* The bucket vector size to use. Must be prime. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9473
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9474 #define CT_SIZE 101
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9475
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9476 /* Value is a hash of the RGB color given by R, G, and B. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9477
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9478 #define CT_HASH_RGB(R, G, B) (((R) << 16) ^ ((G) << 8) ^ (B))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9479
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9480 /* The color hash table. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9481
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9482 struct ct_color **ct_table;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9483
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9484 /* Number of entries in the color table. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9485
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9486 int ct_colors_allocated;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9487
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9488 /* Function prototypes. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9489
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9490 static void init_color_table P_ ((void));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9491 static void free_color_table P_ ((void));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9492 static unsigned long *colors_in_color_table P_ ((int *n));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9493 static unsigned long lookup_rgb_color P_ ((struct frame *f, int r, int g, int b));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9494 static unsigned long lookup_pixel_color P_ ((struct frame *f, unsigned long p));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9495
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9496
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9497 /* Initialize the color table. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9498
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9499 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9500 init_color_table ()
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9501 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9502 int size = CT_SIZE * sizeof (*ct_table);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9503 ct_table = (struct ct_color **) xmalloc (size);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9504 bzero (ct_table, size);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9505 ct_colors_allocated = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9506 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9507
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9508
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9509 /* Free memory associated with the color table. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9510
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9511 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9512 free_color_table ()
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9513 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9514 int i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9515 struct ct_color *p, *next;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9516
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9517 for (i = 0; i < CT_SIZE; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9518 for (p = ct_table[i]; p; p = next)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9519 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9520 next = p->next;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9521 xfree (p);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9522 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9523
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9524 xfree (ct_table);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9525 ct_table = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9526 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9527
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9528
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9529 /* Value is a pixel color for RGB color R, G, B on frame F. If an
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9530 entry for that color already is in the color table, return the
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9531 pixel color of that entry. Otherwise, allocate a new color for R,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9532 G, B, and make an entry in the color table. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9533
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9534 static unsigned long
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9535 lookup_rgb_color (f, r, g, b)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9536 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9537 int r, g, b;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9538 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9539 unsigned hash = CT_HASH_RGB (r, g, b);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9540 int i = hash % CT_SIZE;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9541 struct ct_color *p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9542
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9543 for (p = ct_table[i]; p; p = p->next)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9544 if (p->r == r && p->g == g && p->b == b)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9545 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9546
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9547 if (p == NULL)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9548 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9549 COLORREF color;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9550 Colormap cmap;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9551 int rc;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9552
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9553 color = PALETTERGB (r, g, b);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9554
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9555 ++ct_colors_allocated;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9556
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9557 p = (struct ct_color *) xmalloc (sizeof *p);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9558 p->r = r;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9559 p->g = g;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9560 p->b = b;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9561 p->pixel = color;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9562 p->next = ct_table[i];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9563 ct_table[i] = p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9564 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9565
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9566 return p->pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9567 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9568
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9569
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9570 /* Look up pixel color PIXEL which is used on frame F in the color
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9571 table. If not already present, allocate it. Value is PIXEL. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9572
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9573 static unsigned long
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9574 lookup_pixel_color (f, pixel)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9575 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9576 unsigned long pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9577 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9578 int i = pixel % CT_SIZE;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9579 struct ct_color *p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9580
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9581 for (p = ct_table[i]; p; p = p->next)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9582 if (p->pixel == pixel)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9583 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9584
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9585 if (p == NULL)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9586 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9587 XColor color;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9588 Colormap cmap;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9589 int rc;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9590
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9591 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9592
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9593 cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9594 color.pixel = pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9595 XQueryColor (NULL, cmap, &color);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9596 rc = x_alloc_nearest_color (f, cmap, &color);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9597 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9598
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9599 if (rc)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9600 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9601 ++ct_colors_allocated;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9602
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9603 p = (struct ct_color *) xmalloc (sizeof *p);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9604 p->r = color.red;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9605 p->g = color.green;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9606 p->b = color.blue;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9607 p->pixel = pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9608 p->next = ct_table[i];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9609 ct_table[i] = p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9610 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9611 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9612 return FRAME_FOREGROUND_PIXEL (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9613 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9614 return p->pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9615 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9616
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9617
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9618 /* Value is a vector of all pixel colors contained in the color table,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9619 allocated via xmalloc. Set *N to the number of colors. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9620
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9621 static unsigned long *
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9622 colors_in_color_table (n)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9623 int *n;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9624 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9625 int i, j;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9626 struct ct_color *p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9627 unsigned long *colors;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9628
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9629 if (ct_colors_allocated == 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9630 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9631 *n = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9632 colors = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9633 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9634 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9635 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9636 colors = (unsigned long *) xmalloc (ct_colors_allocated
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9637 * sizeof *colors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9638 *n = ct_colors_allocated;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9639
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9640 for (i = j = 0; i < CT_SIZE; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9641 for (p = ct_table[i]; p; p = p->next)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9642 colors[j++] = p->pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9643 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9644
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9645 return colors;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9646 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9647
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
9648 #endif /* TODO */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9649
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9650
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9651 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9652 Algorithms
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9653 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9654
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
9655 #if 0 /* TODO : W32 versions of low level algorithms */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9656 static void x_laplace_write_row P_ ((struct frame *, long *,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9657 int, XImage *, int));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9658 static void x_laplace_read_row P_ ((struct frame *, Colormap,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9659 XColor *, int, XImage *, int));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9660
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9661
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9662 /* Fill COLORS with RGB colors from row Y of image XIMG. F is the
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9663 frame we operate on, CMAP is the color-map in effect, and WIDTH is
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9664 the width of one row in the image. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9665
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9666 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9667 x_laplace_read_row (f, cmap, colors, width, ximg, y)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9668 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9669 Colormap cmap;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9670 XColor *colors;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9671 int width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9672 XImage *ximg;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9673 int y;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9674 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9675 int x;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9676
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9677 for (x = 0; x < width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9678 colors[x].pixel = XGetPixel (ximg, x, y);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9679
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9680 XQueryColors (NULL, cmap, colors, width);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9681 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9682
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9683
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9684 /* Write row Y of image XIMG. PIXELS is an array of WIDTH longs
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9685 containing the pixel colors to write. F is the frame we are
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9686 working on. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9687
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9688 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9689 x_laplace_write_row (f, pixels, width, ximg, y)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9690 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9691 long *pixels;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9692 int width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9693 XImage *ximg;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9694 int y;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9695 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9696 int x;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9697
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9698 for (x = 0; x < width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9699 XPutPixel (ximg, x, y, pixels[x]);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9700 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9701 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9702
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9703 /* Transform image IMG which is used on frame F with a Laplace
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9704 edge-detection algorithm. The result is an image that can be used
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9705 to draw disabled buttons, for example. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9706
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9707 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9708 x_laplace (f, img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9709 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9710 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9711 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
9712 #if 0 /* TODO : W32 version */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9713 Colormap cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9714 XImage *ximg, *oimg;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9715 XColor *in[3];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9716 long *out;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9717 Pixmap pixmap;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9718 int x, y, i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9719 long pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9720 int in_y, out_y, rc;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9721 int mv2 = 45000;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9722
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9723 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9724
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9725 /* Get the X image IMG->pixmap. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9726 ximg = XGetImage (NULL, img->pixmap,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9727 0, 0, img->width, img->height, ~0, ZPixmap);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9728
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9729 /* Allocate 3 input rows, and one output row of colors. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9730 for (i = 0; i < 3; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9731 in[i] = (XColor *) alloca (img->width * sizeof (XColor));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9732 out = (long *) alloca (img->width * sizeof (long));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9733
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9734 /* Create an X image for output. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9735 rc = x_create_x_image_and_pixmap (f, img->width, img->height, 0,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9736 &oimg, &pixmap);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9737
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9738 /* Fill first two rows. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9739 x_laplace_read_row (f, cmap, in[0], img->width, ximg, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9740 x_laplace_read_row (f, cmap, in[1], img->width, ximg, 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9741 in_y = 2;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9742
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9743 /* Write first row, all zeros. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9744 init_color_table ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9745 pixel = lookup_rgb_color (f, 0, 0, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9746 for (x = 0; x < img->width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9747 out[x] = pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9748 x_laplace_write_row (f, out, img->width, oimg, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9749 out_y = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9750
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9751 for (y = 2; y < img->height; ++y)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9752 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9753 int rowa = y % 3;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9754 int rowb = (y + 2) % 3;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9755
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9756 x_laplace_read_row (f, cmap, in[rowa], img->width, ximg, in_y++);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9757
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9758 for (x = 0; x < img->width - 2; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9759 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9760 int r = in[rowa][x].red + mv2 - in[rowb][x + 2].red;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9761 int g = in[rowa][x].green + mv2 - in[rowb][x + 2].green;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9762 int b = in[rowa][x].blue + mv2 - in[rowb][x + 2].blue;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9763
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9764 out[x + 1] = lookup_rgb_color (f, r & 0xffff, g & 0xffff,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9765 b & 0xffff);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9766 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9767
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9768 x_laplace_write_row (f, out, img->width, oimg, out_y++);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9769 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9770
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9771 /* Write last line, all zeros. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9772 for (x = 0; x < img->width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9773 out[x] = pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9774 x_laplace_write_row (f, out, img->width, oimg, out_y);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9775
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9776 /* Free the input image, and free resources of IMG. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9777 XDestroyImage (ximg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9778 x_clear_image (f, img);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9779
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9780 /* Put the output image into pixmap, and destroy it. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9781 x_put_x_image (f, oimg, pixmap, img->width, img->height);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9782 x_destroy_x_image (oimg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9783
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9784 /* Remember new pixmap and colors in IMG. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9785 img->pixmap = pixmap;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9786 img->colors = colors_in_color_table (&img->ncolors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9787 free_color_table ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9788
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9789 UNBLOCK_INPUT;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
9790 #endif /* TODO */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9791 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9792
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9793
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9794 /* Build a mask for image IMG which is used on frame F. FILE is the
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9795 name of an image file, for error messages. HOW determines how to
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9796 determine the background color of IMG. If it is a list '(R G B)',
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9797 with R, G, and B being integers >= 0, take that as the color of the
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9798 background. Otherwise, determine the background color of IMG
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9799 heuristically. Value is non-zero if successful. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9800
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9801 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9802 x_build_heuristic_mask (f, img, how)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9803 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9804 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9805 Lisp_Object how;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9806 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
9807 #if 0 /* TODO : W32 version */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9808 Display *dpy = FRAME_W32_DISPLAY (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9809 XImage *ximg, *mask_img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9810 int x, y, rc, look_at_corners_p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9811 unsigned long bg;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9812
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9813 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9814
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9815 /* Create an image and pixmap serving as mask. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9816 rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9817 &mask_img, &img->mask);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9818 if (!rc)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9819 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9820 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9821 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9822 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9823
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9824 /* Get the X image of IMG->pixmap. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9825 ximg = XGetImage (dpy, img->pixmap, 0, 0, img->width, img->height,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9826 ~0, ZPixmap);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9827
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9828 /* Determine the background color of ximg. If HOW is `(R G B)'
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9829 take that as color. Otherwise, try to determine the color
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9830 heuristically. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9831 look_at_corners_p = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9832
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9833 if (CONSP (how))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9834 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9835 int rgb[3], i = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9836
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9837 while (i < 3
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9838 && CONSP (how)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9839 && NATNUMP (XCAR (how)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9840 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9841 rgb[i] = XFASTINT (XCAR (how)) & 0xffff;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9842 how = XCDR (how);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9843 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9844
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9845 if (i == 3 && NILP (how))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9846 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9847 char color_name[30];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9848 XColor exact, color;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9849 Colormap cmap;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9850
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9851 sprintf (color_name, "#%04x%04x%04x", rgb[0], rgb[1], rgb[2]);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9852
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9853 cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9854 if (XLookupColor (dpy, cmap, color_name, &exact, &color))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9855 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9856 bg = color.pixel;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9857 look_at_corners_p = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9858 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9859 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9860 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9861
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9862 if (look_at_corners_p)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9863 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9864 unsigned long corners[4];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9865 int i, best_count;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9866
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9867 /* Get the colors at the corners of ximg. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9868 corners[0] = XGetPixel (ximg, 0, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9869 corners[1] = XGetPixel (ximg, img->width - 1, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9870 corners[2] = XGetPixel (ximg, img->width - 1, img->height - 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9871 corners[3] = XGetPixel (ximg, 0, img->height - 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9872
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9873 /* Choose the most frequently found color as background. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9874 for (i = best_count = 0; i < 4; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9875 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9876 int j, n;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9877
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9878 for (j = n = 0; j < 4; ++j)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9879 if (corners[i] == corners[j])
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9880 ++n;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9881
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9882 if (n > best_count)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9883 bg = corners[i], best_count = n;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9884 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9885 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9886
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9887 /* Set all bits in mask_img to 1 whose color in ximg is different
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9888 from the background color bg. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9889 for (y = 0; y < img->height; ++y)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9890 for (x = 0; x < img->width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9891 XPutPixel (mask_img, x, y, XGetPixel (ximg, x, y) != bg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9892
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9893 /* Put mask_img into img->mask. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9894 x_put_x_image (f, mask_img, img->mask, img->width, img->height);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9895 x_destroy_x_image (mask_img);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9896 XDestroyImage (ximg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9897
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9898 UNBLOCK_INPUT;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
9899 #endif /* TODO */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9900
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9901 return 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9902 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9903
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9904
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9905
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9906 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9907 PBM (mono, gray, color)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9908 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9909 #ifdef HAVE_PBM
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9910
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9911 static int pbm_image_p P_ ((Lisp_Object object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9912 static int pbm_load P_ ((struct frame *f, struct image *img));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9913 static int pbm_scan_number P_ ((unsigned char **, unsigned char *));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9914
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9915 /* The symbol `pbm' identifying images of this type. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9916
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9917 Lisp_Object Qpbm;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9918
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9919 /* Indices of image specification fields in gs_format, below. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9920
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9921 enum pbm_keyword_index
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9922 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9923 PBM_TYPE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9924 PBM_FILE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9925 PBM_DATA,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9926 PBM_ASCENT,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9927 PBM_MARGIN,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9928 PBM_RELIEF,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9929 PBM_ALGORITHM,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9930 PBM_HEURISTIC_MASK,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9931 PBM_LAST
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9932 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9933
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9934 /* Vector of image_keyword structures describing the format
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9935 of valid user-defined image specifications. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9936
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9937 static struct image_keyword pbm_format[PBM_LAST] =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9938 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9939 {":type", IMAGE_SYMBOL_VALUE, 1},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9940 {":file", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9941 {":data", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9942 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
9943 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9944 {":relief", IMAGE_INTEGER_VALUE, 0},
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
9945 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9946 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9947 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9948
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9949 /* Structure describing the image type `pbm'. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9950
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9951 static struct image_type pbm_type =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9952 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9953 &Qpbm,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9954 pbm_image_p,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9955 pbm_load,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9956 x_clear_image,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9957 NULL
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9958 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9959
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9960
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9961 /* Return non-zero if OBJECT is a valid PBM image specification. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9962
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9963 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9964 pbm_image_p (object)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9965 Lisp_Object object;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9966 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9967 struct image_keyword fmt[PBM_LAST];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9968
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9969 bcopy (pbm_format, fmt, sizeof fmt);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9970
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9971 if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9972 || (fmt[PBM_ASCENT].count
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9973 && XFASTINT (fmt[PBM_ASCENT].value) > 100))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9974 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9975
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9976 /* Must specify either :data or :file. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9977 return fmt[PBM_DATA].count + fmt[PBM_FILE].count == 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9978 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9979
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9980
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9981 /* Scan a decimal number from *S and return it. Advance *S while
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9982 reading the number. END is the end of the string. Value is -1 at
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9983 end of input. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9984
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9985 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9986 pbm_scan_number (s, end)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9987 unsigned char **s, *end;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9988 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9989 int c, val = -1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9990
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9991 while (*s < end)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9992 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9993 /* Skip white-space. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9994 while (*s < end && (c = *(*s)++, isspace (c)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9995 ;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9996
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9997 if (c == '#')
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9998 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9999 /* Skip comment to end of line. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10000 while (*s < end && (c = *(*s)++, c != '\n'))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10001 ;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10002 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10003 else if (isdigit (c))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10004 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10005 /* Read decimal number. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10006 val = c - '0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10007 while (*s < end && (c = *(*s)++, isdigit (c)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10008 val = 10 * val + c - '0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10009 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10010 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10011 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10012 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10013 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10014
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10015 return val;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10016 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10017
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10018
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10019 /* Read FILE into memory. Value is a pointer to a buffer allocated
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10020 with xmalloc holding FILE's contents. Value is null if an error
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10021 occured. *SIZE is set to the size of the file. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10022
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10023 static char *
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10024 pbm_read_file (file, size)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10025 Lisp_Object file;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10026 int *size;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10027 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10028 FILE *fp = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10029 char *buf = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10030 struct stat st;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10031
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10032 if (stat (XSTRING (file)->data, &st) == 0
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10033 && (fp = fopen (XSTRING (file)->data, "r")) != NULL
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10034 && (buf = (char *) xmalloc (st.st_size),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10035 fread (buf, 1, st.st_size, fp) == st.st_size))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10036 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10037 *size = st.st_size;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10038 fclose (fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10039 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10040 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10041 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10042 if (fp)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10043 fclose (fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10044 if (buf)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10045 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10046 xfree (buf);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10047 buf = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10048 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10049 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10050
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10051 return buf;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10052 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10053
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10054
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10055 /* Load PBM image IMG for use on frame F. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10056
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10057 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10058 pbm_load (f, img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10059 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10060 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10061 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10062 int raw_p, x, y;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10063 int width, height, max_color_idx = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10064 XImage *ximg;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10065 Lisp_Object file, specified_file;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10066 enum {PBM_MONO, PBM_GRAY, PBM_COLOR} type;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10067 struct gcpro gcpro1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10068 unsigned char *contents = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10069 unsigned char *end, *p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10070 int size;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10071
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10072 specified_file = image_spec_value (img->spec, QCfile, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10073 file = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10074 GCPRO1 (file);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10075
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10076 if (STRINGP (specified_file))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10077 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10078 file = x_find_image_file (specified_file);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10079 if (!STRINGP (file))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10080 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10081 image_error ("Cannot find image file `%s'", specified_file, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10082 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10083 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10084 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10085
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10086 contents = pbm_read_file (file, &size);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10087 if (contents == NULL)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10088 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10089 image_error ("Error reading `%s'", file, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10090 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10091 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10092 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10093
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10094 p = contents;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10095 end = contents + size;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10096 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10097 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10098 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10099 Lisp_Object data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10100 data = image_spec_value (img->spec, QCdata, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10101 p = XSTRING (data)->data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10102 end = p + STRING_BYTES (XSTRING (data));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10103 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10104
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10105 /* Check magic number. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10106 if (end - p < 2 || *p++ != 'P')
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10107 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10108 image_error ("Not a PBM image: `%s'", img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10109 error:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10110 xfree (contents);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10111 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10112 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10113 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10114
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10115 switch (*p++)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10116 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10117 case '1':
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10118 raw_p = 0, type = PBM_MONO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10119 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10120
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10121 case '2':
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10122 raw_p = 0, type = PBM_GRAY;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10123 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10124
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10125 case '3':
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10126 raw_p = 0, type = PBM_COLOR;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10127 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10128
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10129 case '4':
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10130 raw_p = 1, type = PBM_MONO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10131 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10132
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10133 case '5':
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10134 raw_p = 1, type = PBM_GRAY;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10135 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10136
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10137 case '6':
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10138 raw_p = 1, type = PBM_COLOR;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10139 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10140
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10141 default:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10142 image_error ("Not a PBM image: `%s'", img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10143 goto error;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10144 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10145
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10146 /* Read width, height, maximum color-component. Characters
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10147 starting with `#' up to the end of a line are ignored. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10148 width = pbm_scan_number (&p, end);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10149 height = pbm_scan_number (&p, end);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10150
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10151 if (type != PBM_MONO)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10152 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10153 max_color_idx = pbm_scan_number (&p, end);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10154 if (raw_p && max_color_idx > 255)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10155 max_color_idx = 255;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10156 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10157
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10158 if (width < 0
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10159 || height < 0
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10160 || (type != PBM_MONO && max_color_idx < 0))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10161 goto error;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10162
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10163 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10164 if (!x_create_x_image_and_pixmap (f, width, height, 0,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10165 &ximg, &img->pixmap))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10166 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10167 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10168 goto error;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10169 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10170
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10171 /* Initialize the color hash table. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10172 init_color_table ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10173
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10174 if (type == PBM_MONO)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10175 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10176 int c = 0, g;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10177
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10178 for (y = 0; y < height; ++y)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10179 for (x = 0; x < width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10180 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10181 if (raw_p)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10182 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10183 if ((x & 7) == 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10184 c = *p++;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10185 g = c & 0x80;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10186 c <<= 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10187 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10188 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10189 g = pbm_scan_number (&p, end);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10190
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10191 XPutPixel (ximg, x, y, (g
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10192 ? FRAME_FOREGROUND_PIXEL (f)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10193 : FRAME_BACKGROUND_PIXEL (f)));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10194 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10195 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10196 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10197 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10198 for (y = 0; y < height; ++y)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10199 for (x = 0; x < width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10200 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10201 int r, g, b;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10202
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10203 if (type == PBM_GRAY)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10204 r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10205 else if (raw_p)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10206 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10207 r = *p++;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10208 g = *p++;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10209 b = *p++;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10210 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10211 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10212 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10213 r = pbm_scan_number (&p, end);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10214 g = pbm_scan_number (&p, end);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10215 b = pbm_scan_number (&p, end);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10216 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10217
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10218 if (r < 0 || g < 0 || b < 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10219 {
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
10220 xfree (ximg->data);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10221 ximg->data = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10222 XDestroyImage (ximg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10223 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10224 image_error ("Invalid pixel value in image `%s'",
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10225 img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10226 goto error;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10227 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10228
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10229 /* RGB values are now in the range 0..max_color_idx.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10230 Scale this to the range 0..0xffff supported by X. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10231 r = (double) r * 65535 / max_color_idx;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10232 g = (double) g * 65535 / max_color_idx;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10233 b = (double) b * 65535 / max_color_idx;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10234 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10235 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10236 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10237
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10238 /* Store in IMG->colors the colors allocated for the image, and
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10239 free the color table. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10240 img->colors = colors_in_color_table (&img->ncolors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10241 free_color_table ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10242
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10243 /* Put the image into a pixmap. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10244 x_put_x_image (f, ximg, img->pixmap, width, height);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10245 x_destroy_x_image (ximg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10246 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10247
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10248 img->width = width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10249 img->height = height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10250
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10251 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10252 xfree (contents);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10253 return 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10254 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10255 #endif /* HAVE_PBM */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10256
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10257
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10258 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10259 PNG
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10260 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10261
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10262 #if HAVE_PNG
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10263
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10264 #include <png.h>
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10265
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10266 /* Function prototypes. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10267
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10268 static int png_image_p P_ ((Lisp_Object object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10269 static int png_load P_ ((struct frame *f, struct image *img));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10270
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10271 /* The symbol `png' identifying images of this type. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10272
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10273 Lisp_Object Qpng;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10274
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10275 /* Indices of image specification fields in png_format, below. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10276
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10277 enum png_keyword_index
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10278 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10279 PNG_TYPE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10280 PNG_DATA,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10281 PNG_FILE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10282 PNG_ASCENT,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10283 PNG_MARGIN,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10284 PNG_RELIEF,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10285 PNG_ALGORITHM,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10286 PNG_HEURISTIC_MASK,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10287 PNG_LAST
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10288 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10289
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10290 /* Vector of image_keyword structures describing the format
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10291 of valid user-defined image specifications. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10292
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10293 static struct image_keyword png_format[PNG_LAST] =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10294 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10295 {":type", IMAGE_SYMBOL_VALUE, 1},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10296 {":data", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10297 {":file", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10298 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
10299 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10300 {":relief", IMAGE_INTEGER_VALUE, 0},
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
10301 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10302 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10303 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10304
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10305 /* Structure describing the image type `png'. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10306
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10307 static struct image_type png_type =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10308 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10309 &Qpng,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10310 png_image_p,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10311 png_load,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10312 x_clear_image,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10313 NULL
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10314 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10315
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10316
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10317 /* Return non-zero if OBJECT is a valid PNG image specification. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10318
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10319 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10320 png_image_p (object)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10321 Lisp_Object object;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10322 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10323 struct image_keyword fmt[PNG_LAST];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10324 bcopy (png_format, fmt, sizeof fmt);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10325
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10326 if (!parse_image_spec (object, fmt, PNG_LAST, Qpng)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10327 || (fmt[PNG_ASCENT].count
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10328 && XFASTINT (fmt[PNG_ASCENT].value) > 100))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10329 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10330
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10331 /* Must specify either the :data or :file keyword. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10332 return fmt[PNG_FILE].count + fmt[PNG_DATA].count == 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10333 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10334
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10335
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10336 /* Error and warning handlers installed when the PNG library
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10337 is initialized. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10338
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10339 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10340 my_png_error (png_ptr, msg)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10341 png_struct *png_ptr;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10342 char *msg;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10343 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10344 xassert (png_ptr != NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10345 image_error ("PNG error: %s", build_string (msg), Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10346 longjmp (png_ptr->jmpbuf, 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10347 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10348
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10349
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10350 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10351 my_png_warning (png_ptr, msg)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10352 png_struct *png_ptr;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10353 char *msg;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10354 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10355 xassert (png_ptr != NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10356 image_error ("PNG warning: %s", build_string (msg), Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10357 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10358
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10359 /* Memory source for PNG decoding. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10360
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10361 struct png_memory_storage
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10362 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10363 unsigned char *bytes; /* The data */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10364 size_t len; /* How big is it? */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10365 int index; /* Where are we? */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10366 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10367
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10368
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10369 /* Function set as reader function when reading PNG image from memory.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10370 PNG_PTR is a pointer to the PNG control structure. Copy LENGTH
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10371 bytes from the input to DATA. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10372
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10373 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10374 png_read_from_memory (png_ptr, data, length)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10375 png_structp png_ptr;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10376 png_bytep data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10377 png_size_t length;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10378 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10379 struct png_memory_storage *tbr
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10380 = (struct png_memory_storage *) png_get_io_ptr (png_ptr);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10381
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10382 if (length > tbr->len - tbr->index)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10383 png_error (png_ptr, "Read error");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10384
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10385 bcopy (tbr->bytes + tbr->index, data, length);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10386 tbr->index = tbr->index + length;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10387 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10388
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10389 /* Load PNG image IMG for use on frame F. Value is non-zero if
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10390 successful. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10391
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10392 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10393 png_load (f, img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10394 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10395 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10396 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10397 Lisp_Object file, specified_file;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10398 Lisp_Object specified_data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10399 int x, y, i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10400 XImage *ximg, *mask_img = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10401 struct gcpro gcpro1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10402 png_struct *png_ptr = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10403 png_info *info_ptr = NULL, *end_info = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10404 FILE *fp = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10405 png_byte sig[8];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10406 png_byte *pixels = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10407 png_byte **rows = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10408 png_uint_32 width, height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10409 int bit_depth, color_type, interlace_type;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10410 png_byte channels;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10411 png_uint_32 row_bytes;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10412 int transparent_p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10413 char *gamma_str;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10414 double screen_gamma, image_gamma;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10415 int intent;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10416 struct png_memory_storage tbr; /* Data to be read */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10417
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10418 /* Find out what file to load. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10419 specified_file = image_spec_value (img->spec, QCfile, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10420 specified_data = image_spec_value (img->spec, QCdata, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10421 file = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10422 GCPRO1 (file);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10423
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10424 if (NILP (specified_data))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10425 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10426 file = x_find_image_file (specified_file);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10427 if (!STRINGP (file))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10428 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10429 image_error ("Cannot find image file `%s'", specified_file, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10430 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10431 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10432 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10433
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10434 /* Open the image file. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10435 fp = fopen (XSTRING (file)->data, "rb");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10436 if (!fp)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10437 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10438 image_error ("Cannot open image file `%s'", file, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10439 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10440 fclose (fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10441 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10442 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10443
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10444 /* Check PNG signature. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10445 if (fread (sig, 1, sizeof sig, fp) != sizeof sig
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10446 || !png_check_sig (sig, sizeof sig))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10447 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10448 image_error ("Not a PNG file:` %s'", file, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10449 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10450 fclose (fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10451 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10452 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10453 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10454 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10455 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10456 /* Read from memory. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10457 tbr.bytes = XSTRING (specified_data)->data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10458 tbr.len = STRING_BYTES (XSTRING (specified_data));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10459 tbr.index = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10460
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10461 /* Check PNG signature. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10462 if (tbr.len < sizeof sig
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10463 || !png_check_sig (tbr.bytes, sizeof sig))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10464 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10465 image_error ("Not a PNG image: `%s'", img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10466 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10467 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10468 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10469
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10470 /* Need to skip past the signature. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10471 tbr.bytes += sizeof (sig);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10472 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10473
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10474 /* Initialize read and info structs for PNG lib. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10475 png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10476 my_png_error, my_png_warning);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10477 if (!png_ptr)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10478 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10479 if (fp) fclose (fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10480 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10481 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10482 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10483
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10484 info_ptr = png_create_info_struct (png_ptr);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10485 if (!info_ptr)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10486 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10487 png_destroy_read_struct (&png_ptr, NULL, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10488 if (fp) fclose (fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10489 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10490 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10491 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10492
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10493 end_info = png_create_info_struct (png_ptr);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10494 if (!end_info)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10495 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10496 png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10497 if (fp) fclose (fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10498 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10499 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10500 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10501
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10502 /* Set error jump-back. We come back here when the PNG library
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10503 detects an error. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10504 if (setjmp (png_ptr->jmpbuf))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10505 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10506 error:
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10507 if (png_ptr)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10508 png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10509 xfree (pixels);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10510 xfree (rows);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10511 if (fp) fclose (fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10512 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10513 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10514 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10515
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10516 /* Read image info. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10517 if (!NILP (specified_data))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10518 png_set_read_fn (png_ptr, (void *) &tbr, png_read_from_memory);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10519 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10520 png_init_io (png_ptr, fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10521
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10522 png_set_sig_bytes (png_ptr, sizeof sig);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10523 png_read_info (png_ptr, info_ptr);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10524 png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10525 &interlace_type, NULL, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10526
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10527 /* If image contains simply transparency data, we prefer to
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10528 construct a clipping mask. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10529 if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10530 transparent_p = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10531 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10532 transparent_p = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10533
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10534 /* This function is easier to write if we only have to handle
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10535 one data format: RGB or RGBA with 8 bits per channel. Let's
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10536 transform other formats into that format. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10537
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10538 /* Strip more than 8 bits per channel. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10539 if (bit_depth == 16)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10540 png_set_strip_16 (png_ptr);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10541
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10542 /* Expand data to 24 bit RGB, or 8 bit grayscale, with alpha channel
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10543 if available. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10544 png_set_expand (png_ptr);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10545
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10546 /* Convert grayscale images to RGB. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10547 if (color_type == PNG_COLOR_TYPE_GRAY
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10548 || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10549 png_set_gray_to_rgb (png_ptr);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10550
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10551 /* The value 2.2 is a guess for PC monitors from PNG example.c. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10552 gamma_str = getenv ("SCREEN_GAMMA");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10553 screen_gamma = gamma_str ? atof (gamma_str) : 2.2;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10554
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10555 /* Tell the PNG lib to handle gamma correction for us. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10556
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10557 #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10558 if (png_get_sRGB (png_ptr, info_ptr, &intent))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10559 /* There is a special chunk in the image specifying the gamma. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10560 png_set_sRGB (png_ptr, info_ptr, intent);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10561 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10562 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10563 if (png_get_gAMA (png_ptr, info_ptr, &image_gamma))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10564 /* Image contains gamma information. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10565 png_set_gamma (png_ptr, screen_gamma, image_gamma);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10566 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10567 /* Use a default of 0.5 for the image gamma. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10568 png_set_gamma (png_ptr, screen_gamma, 0.5);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10569
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10570 /* Handle alpha channel by combining the image with a background
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10571 color. Do this only if a real alpha channel is supplied. For
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10572 simple transparency, we prefer a clipping mask. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10573 if (!transparent_p)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10574 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10575 png_color_16 *image_background;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10576
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10577 if (png_get_bKGD (png_ptr, info_ptr, &image_background))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10578 /* Image contains a background color with which to
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10579 combine the image. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10580 png_set_background (png_ptr, image_background,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10581 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10582 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10583 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10584 /* Image does not contain a background color with which
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10585 to combine the image data via an alpha channel. Use
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10586 the frame's background instead. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10587 XColor color;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10588 Colormap cmap;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10589 png_color_16 frame_background;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10590
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10591 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10592 cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10593 color.pixel = FRAME_BACKGROUND_PIXEL (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10594 XQueryColor (FRAME_W32_DISPLAY (f), cmap, &color);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10595 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10596
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10597 bzero (&frame_background, sizeof frame_background);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10598 frame_background.red = color.red;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10599 frame_background.green = color.green;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10600 frame_background.blue = color.blue;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10601
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10602 png_set_background (png_ptr, &frame_background,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10603 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10604 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10605 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10606
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10607 /* Update info structure. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10608 png_read_update_info (png_ptr, info_ptr);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10609
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10610 /* Get number of channels. Valid values are 1 for grayscale images
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10611 and images with a palette, 2 for grayscale images with transparency
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10612 information (alpha channel), 3 for RGB images, and 4 for RGB
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10613 images with alpha channel, i.e. RGBA. If conversions above were
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10614 sufficient we should only have 3 or 4 channels here. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10615 channels = png_get_channels (png_ptr, info_ptr);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10616 xassert (channels == 3 || channels == 4);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10617
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10618 /* Number of bytes needed for one row of the image. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10619 row_bytes = png_get_rowbytes (png_ptr, info_ptr);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10620
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10621 /* Allocate memory for the image. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10622 pixels = (png_byte *) xmalloc (row_bytes * height * sizeof *pixels);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10623 rows = (png_byte **) xmalloc (height * sizeof *rows);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10624 for (i = 0; i < height; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10625 rows[i] = pixels + i * row_bytes;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10626
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10627 /* Read the entire image. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10628 png_read_image (png_ptr, rows);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10629 png_read_end (png_ptr, info_ptr);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10630 if (fp)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10631 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10632 fclose (fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10633 fp = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10634 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10635
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10636 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10637
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10638 /* Create the X image and pixmap. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10639 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10640 &img->pixmap))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10641 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10642 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10643 goto error;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10644 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10645
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10646 /* Create an image and pixmap serving as mask if the PNG image
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10647 contains an alpha channel. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10648 if (channels == 4
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10649 && !transparent_p
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10650 && !x_create_x_image_and_pixmap (f, width, height, 1,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10651 &mask_img, &img->mask))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10652 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10653 x_destroy_x_image (ximg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10654 XFreePixmap (FRAME_W32_DISPLAY (f), img->pixmap);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10655 img->pixmap = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10656 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10657 goto error;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10658 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10659
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10660 /* Fill the X image and mask from PNG data. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10661 init_color_table ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10662
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10663 for (y = 0; y < height; ++y)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10664 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10665 png_byte *p = rows[y];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10666
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10667 for (x = 0; x < width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10668 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10669 unsigned r, g, b;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10670
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10671 r = *p++ << 8;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10672 g = *p++ << 8;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10673 b = *p++ << 8;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10674 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10675
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10676 /* An alpha channel, aka mask channel, associates variable
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10677 transparency with an image. Where other image formats
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10678 support binary transparency---fully transparent or fully
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10679 opaque---PNG allows up to 254 levels of partial transparency.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10680 The PNG library implements partial transparency by combining
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10681 the image with a specified background color.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10682
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10683 I'm not sure how to handle this here nicely: because the
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10684 background on which the image is displayed may change, for
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10685 real alpha channel support, it would be necessary to create
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10686 a new image for each possible background.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10687
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10688 What I'm doing now is that a mask is created if we have
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10689 boolean transparency information. Otherwise I'm using
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10690 the frame's background color to combine the image with. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10691
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10692 if (channels == 4)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10693 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10694 if (mask_img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10695 XPutPixel (mask_img, x, y, *p > 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10696 ++p;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10697 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10698 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10699 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10700
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10701 /* Remember colors allocated for this image. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10702 img->colors = colors_in_color_table (&img->ncolors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10703 free_color_table ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10704
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10705 /* Clean up. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10706 png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10707 xfree (rows);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10708 xfree (pixels);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10709
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10710 img->width = width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10711 img->height = height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10712
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10713 /* Put the image into the pixmap, then free the X image and its buffer. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10714 x_put_x_image (f, ximg, img->pixmap, width, height);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10715 x_destroy_x_image (ximg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10716
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10717 /* Same for the mask. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10718 if (mask_img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10719 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10720 x_put_x_image (f, mask_img, img->mask, img->width, img->height);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10721 x_destroy_x_image (mask_img);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10722 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10723
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10724 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10725 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10726 return 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10727 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10728
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10729 #endif /* HAVE_PNG != 0 */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10730
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10731
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10732
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10733 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10734 JPEG
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10735 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10736
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10737 #if HAVE_JPEG
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10738
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10739 /* Work around a warning about HAVE_STDLIB_H being redefined in
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10740 jconfig.h. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10741 #ifdef HAVE_STDLIB_H
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10742 #define HAVE_STDLIB_H_1
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10743 #undef HAVE_STDLIB_H
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10744 #endif /* HAVE_STLIB_H */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10745
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10746 #include <jpeglib.h>
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10747 #include <jerror.h>
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10748 #include <setjmp.h>
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10749
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10750 #ifdef HAVE_STLIB_H_1
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10751 #define HAVE_STDLIB_H 1
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10752 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10753
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10754 static int jpeg_image_p P_ ((Lisp_Object object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10755 static int jpeg_load P_ ((struct frame *f, struct image *img));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10756
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10757 /* The symbol `jpeg' identifying images of this type. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10758
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10759 Lisp_Object Qjpeg;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10760
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10761 /* Indices of image specification fields in gs_format, below. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10762
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10763 enum jpeg_keyword_index
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10764 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10765 JPEG_TYPE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10766 JPEG_DATA,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10767 JPEG_FILE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10768 JPEG_ASCENT,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10769 JPEG_MARGIN,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10770 JPEG_RELIEF,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10771 JPEG_ALGORITHM,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10772 JPEG_HEURISTIC_MASK,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10773 JPEG_LAST
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10774 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10775
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10776 /* Vector of image_keyword structures describing the format
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10777 of valid user-defined image specifications. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10778
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10779 static struct image_keyword jpeg_format[JPEG_LAST] =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10780 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10781 {":type", IMAGE_SYMBOL_VALUE, 1},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10782 {":data", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10783 {":file", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10784 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
10785 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10786 {":relief", IMAGE_INTEGER_VALUE, 0},
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
10787 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10788 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10789 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10790
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10791 /* Structure describing the image type `jpeg'. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10792
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10793 static struct image_type jpeg_type =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10794 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10795 &Qjpeg,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10796 jpeg_image_p,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10797 jpeg_load,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10798 x_clear_image,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10799 NULL
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10800 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10801
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10802
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10803 /* Return non-zero if OBJECT is a valid JPEG image specification. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10804
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10805 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10806 jpeg_image_p (object)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10807 Lisp_Object object;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10808 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10809 struct image_keyword fmt[JPEG_LAST];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10810
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10811 bcopy (jpeg_format, fmt, sizeof fmt);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10812
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10813 if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10814 || (fmt[JPEG_ASCENT].count
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10815 && XFASTINT (fmt[JPEG_ASCENT].value) > 100))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10816 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10817
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10818 /* Must specify either the :data or :file keyword. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10819 return fmt[JPEG_FILE].count + fmt[JPEG_DATA].count == 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10820 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10821
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10822
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10823 struct my_jpeg_error_mgr
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10824 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10825 struct jpeg_error_mgr pub;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10826 jmp_buf setjmp_buffer;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10827 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10828
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10829 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10830 my_error_exit (cinfo)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10831 j_common_ptr cinfo;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10832 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10833 struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10834 longjmp (mgr->setjmp_buffer, 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10835 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10836
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10837 /* Init source method for JPEG data source manager. Called by
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10838 jpeg_read_header() before any data is actually read. See
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10839 libjpeg.doc from the JPEG lib distribution. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10840
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10841 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10842 our_init_source (cinfo)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10843 j_decompress_ptr cinfo;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10844 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10845 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10846
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10847
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10848 /* Fill input buffer method for JPEG data source manager. Called
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10849 whenever more data is needed. We read the whole image in one step,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10850 so this only adds a fake end of input marker at the end. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10851
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10852 static boolean
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10853 our_fill_input_buffer (cinfo)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10854 j_decompress_ptr cinfo;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10855 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10856 /* Insert a fake EOI marker. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10857 struct jpeg_source_mgr *src = cinfo->src;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10858 static JOCTET buffer[2];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10859
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10860 buffer[0] = (JOCTET) 0xFF;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10861 buffer[1] = (JOCTET) JPEG_EOI;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10862
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10863 src->next_input_byte = buffer;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10864 src->bytes_in_buffer = 2;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10865 return TRUE;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10866 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10867
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10868
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10869 /* Method to skip over NUM_BYTES bytes in the image data. CINFO->src
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10870 is the JPEG data source manager. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10871
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10872 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10873 our_skip_input_data (cinfo, num_bytes)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10874 j_decompress_ptr cinfo;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10875 long num_bytes;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10876 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10877 struct jpeg_source_mgr *src = (struct jpeg_source_mgr *) cinfo->src;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10878
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10879 if (src)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10880 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10881 if (num_bytes > src->bytes_in_buffer)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10882 ERREXIT (cinfo, JERR_INPUT_EOF);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10883
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10884 src->bytes_in_buffer -= num_bytes;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10885 src->next_input_byte += num_bytes;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10886 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10887 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10888
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10889
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10890 /* Method to terminate data source. Called by
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10891 jpeg_finish_decompress() after all data has been processed. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10892
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10893 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10894 our_term_source (cinfo)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10895 j_decompress_ptr cinfo;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10896 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10897 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10898
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10899
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10900 /* Set up the JPEG lib for reading an image from DATA which contains
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10901 LEN bytes. CINFO is the decompression info structure created for
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10902 reading the image. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10903
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10904 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10905 jpeg_memory_src (cinfo, data, len)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10906 j_decompress_ptr cinfo;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10907 JOCTET *data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10908 unsigned int len;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10909 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10910 struct jpeg_source_mgr *src;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10911
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10912 if (cinfo->src == NULL)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10913 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10914 /* First time for this JPEG object? */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10915 cinfo->src = (struct jpeg_source_mgr *)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10916 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10917 sizeof (struct jpeg_source_mgr));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10918 src = (struct jpeg_source_mgr *) cinfo->src;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10919 src->next_input_byte = data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10920 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10921
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10922 src = (struct jpeg_source_mgr *) cinfo->src;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10923 src->init_source = our_init_source;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10924 src->fill_input_buffer = our_fill_input_buffer;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10925 src->skip_input_data = our_skip_input_data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10926 src->resync_to_restart = jpeg_resync_to_restart; /* Use default method. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10927 src->term_source = our_term_source;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10928 src->bytes_in_buffer = len;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10929 src->next_input_byte = data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10930 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10931
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10932
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10933 /* Load image IMG for use on frame F. Patterned after example.c
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10934 from the JPEG lib. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10935
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10936 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10937 jpeg_load (f, img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10938 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10939 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10940 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10941 struct jpeg_decompress_struct cinfo;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10942 struct my_jpeg_error_mgr mgr;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10943 Lisp_Object file, specified_file;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10944 Lisp_Object specified_data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10945 FILE *fp = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10946 JSAMPARRAY buffer;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10947 int row_stride, x, y;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10948 XImage *ximg = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10949 int rc;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10950 unsigned long *colors;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10951 int width, height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10952 struct gcpro gcpro1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10953
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10954 /* Open the JPEG file. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10955 specified_file = image_spec_value (img->spec, QCfile, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10956 specified_data = image_spec_value (img->spec, QCdata, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10957 file = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10958 GCPRO1 (file);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10959
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10960 if (NILP (specified_data))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10961 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10962 file = x_find_image_file (specified_file);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10963 if (!STRINGP (file))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10964 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10965 image_error ("Cannot find image file `%s'", specified_file, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10966 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10967 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10968 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10969
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10970 fp = fopen (XSTRING (file)->data, "r");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10971 if (fp == NULL)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10972 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10973 image_error ("Cannot open `%s'", file, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10974 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10975 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10976 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10977 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10978
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10979 /* Customize libjpeg's error handling to call my_error_exit when an
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10980 error is detected. This function will perform a longjmp. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10981 mgr.pub.error_exit = my_error_exit;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10982 cinfo.err = jpeg_std_error (&mgr.pub);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10983
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10984 if ((rc = setjmp (mgr.setjmp_buffer)) != 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10985 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10986 if (rc == 1)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10987 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10988 /* Called from my_error_exit. Display a JPEG error. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10989 char buffer[JMSG_LENGTH_MAX];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10990 cinfo.err->format_message ((j_common_ptr) &cinfo, buffer);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10991 image_error ("Error reading JPEG image `%s': %s", img->spec,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10992 build_string (buffer));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10993 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10994
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10995 /* Close the input file and destroy the JPEG object. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10996 if (fp)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10997 fclose (fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10998 jpeg_destroy_decompress (&cinfo);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
10999
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11000 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11001
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11002 /* If we already have an XImage, free that. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11003 x_destroy_x_image (ximg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11004
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11005 /* Free pixmap and colors. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11006 x_clear_image (f, img);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11007
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11008 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11009 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11010 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11011 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11012
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11013 /* Create the JPEG decompression object. Let it read from fp.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11014 Read the JPEG image header. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11015 jpeg_create_decompress (&cinfo);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11016
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11017 if (NILP (specified_data))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11018 jpeg_stdio_src (&cinfo, fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11019 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11020 jpeg_memory_src (&cinfo, XSTRING (specified_data)->data,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11021 STRING_BYTES (XSTRING (specified_data)));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11022
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11023 jpeg_read_header (&cinfo, TRUE);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11024
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11025 /* Customize decompression so that color quantization will be used.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11026 Start decompression. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11027 cinfo.quantize_colors = TRUE;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11028 jpeg_start_decompress (&cinfo);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11029 width = img->width = cinfo.output_width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11030 height = img->height = cinfo.output_height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11031
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11032 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11033
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11034 /* Create X image and pixmap. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11035 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11036 &img->pixmap))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11037 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11038 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11039 longjmp (mgr.setjmp_buffer, 2);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11040 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11041
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11042 /* Allocate colors. When color quantization is used,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11043 cinfo.actual_number_of_colors has been set with the number of
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11044 colors generated, and cinfo.colormap is a two-dimensional array
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11045 of color indices in the range 0..cinfo.actual_number_of_colors.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11046 No more than 255 colors will be generated. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11047 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11048 int i, ir, ig, ib;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11049
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11050 if (cinfo.out_color_components > 2)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11051 ir = 0, ig = 1, ib = 2;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11052 else if (cinfo.out_color_components > 1)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11053 ir = 0, ig = 1, ib = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11054 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11055 ir = 0, ig = 0, ib = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11056
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11057 /* Use the color table mechanism because it handles colors that
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11058 cannot be allocated nicely. Such colors will be replaced with
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11059 a default color, and we don't have to care about which colors
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11060 can be freed safely, and which can't. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11061 init_color_table ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11062 colors = (unsigned long *) alloca (cinfo.actual_number_of_colors
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11063 * sizeof *colors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11064
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11065 for (i = 0; i < cinfo.actual_number_of_colors; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11066 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11067 /* Multiply RGB values with 255 because X expects RGB values
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11068 in the range 0..0xffff. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11069 int r = cinfo.colormap[ir][i] << 8;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11070 int g = cinfo.colormap[ig][i] << 8;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11071 int b = cinfo.colormap[ib][i] << 8;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11072 colors[i] = lookup_rgb_color (f, r, g, b);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11073 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11074
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11075 /* Remember those colors actually allocated. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11076 img->colors = colors_in_color_table (&img->ncolors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11077 free_color_table ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11078 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11079
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11080 /* Read pixels. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11081 row_stride = width * cinfo.output_components;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11082 buffer = cinfo.mem->alloc_sarray ((j_common_ptr) &cinfo, JPOOL_IMAGE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11083 row_stride, 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11084 for (y = 0; y < height; ++y)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11085 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11086 jpeg_read_scanlines (&cinfo, buffer, 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11087 for (x = 0; x < cinfo.output_width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11088 XPutPixel (ximg, x, y, colors[buffer[0][x]]);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11089 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11090
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11091 /* Clean up. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11092 jpeg_finish_decompress (&cinfo);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11093 jpeg_destroy_decompress (&cinfo);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11094 if (fp)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11095 fclose (fp);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11096
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11097 /* Put the image into the pixmap. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11098 x_put_x_image (f, ximg, img->pixmap, width, height);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11099 x_destroy_x_image (ximg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11100 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11101 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11102 return 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11103 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11104
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11105 #endif /* HAVE_JPEG */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11106
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11107
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11108
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11109 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11110 TIFF
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11111 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11112
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11113 #if HAVE_TIFF
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11114
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11115 #include <tiffio.h>
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11116
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11117 static int tiff_image_p P_ ((Lisp_Object object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11118 static int tiff_load P_ ((struct frame *f, struct image *img));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11119
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11120 /* The symbol `tiff' identifying images of this type. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11121
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11122 Lisp_Object Qtiff;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11123
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11124 /* Indices of image specification fields in tiff_format, below. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11125
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11126 enum tiff_keyword_index
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11127 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11128 TIFF_TYPE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11129 TIFF_DATA,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11130 TIFF_FILE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11131 TIFF_ASCENT,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11132 TIFF_MARGIN,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11133 TIFF_RELIEF,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11134 TIFF_ALGORITHM,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11135 TIFF_HEURISTIC_MASK,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11136 TIFF_LAST
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11137 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11138
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11139 /* Vector of image_keyword structures describing the format
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11140 of valid user-defined image specifications. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11141
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11142 static struct image_keyword tiff_format[TIFF_LAST] =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11143 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11144 {":type", IMAGE_SYMBOL_VALUE, 1},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11145 {":data", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11146 {":file", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11147 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
11148 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11149 {":relief", IMAGE_INTEGER_VALUE, 0},
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
11150 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11151 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11152 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11153
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11154 /* Structure describing the image type `tiff'. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11155
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11156 static struct image_type tiff_type =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11157 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11158 &Qtiff,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11159 tiff_image_p,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11160 tiff_load,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11161 x_clear_image,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11162 NULL
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11163 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11164
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11165
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11166 /* Return non-zero if OBJECT is a valid TIFF image specification. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11167
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11168 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11169 tiff_image_p (object)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11170 Lisp_Object object;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11171 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11172 struct image_keyword fmt[TIFF_LAST];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11173 bcopy (tiff_format, fmt, sizeof fmt);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11174
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11175 if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11176 || (fmt[TIFF_ASCENT].count
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11177 && XFASTINT (fmt[TIFF_ASCENT].value) > 100))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11178 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11179
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11180 /* Must specify either the :data or :file keyword. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11181 return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11182 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11183
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11184
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11185 /* Reading from a memory buffer for TIFF images Based on the PNG
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11186 memory source, but we have to provide a lot of extra functions.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11187 Blah.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11188
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11189 We really only need to implement read and seek, but I am not
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11190 convinced that the TIFF library is smart enough not to destroy
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11191 itself if we only hand it the function pointers we need to
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11192 override. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11193
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11194 typedef struct
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11195 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11196 unsigned char *bytes;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11197 size_t len;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11198 int index;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11199 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11200 tiff_memory_source;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11201
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11202 static size_t
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11203 tiff_read_from_memory (data, buf, size)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11204 thandle_t data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11205 tdata_t buf;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11206 tsize_t size;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11207 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11208 tiff_memory_source *src = (tiff_memory_source *) data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11209
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11210 if (size > src->len - src->index)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11211 return (size_t) -1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11212 bcopy (src->bytes + src->index, buf, size);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11213 src->index += size;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11214 return size;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11215 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11216
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11217 static size_t
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11218 tiff_write_from_memory (data, buf, size)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11219 thandle_t data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11220 tdata_t buf;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11221 tsize_t size;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11222 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11223 return (size_t) -1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11224 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11225
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11226 static toff_t
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11227 tiff_seek_in_memory (data, off, whence)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11228 thandle_t data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11229 toff_t off;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11230 int whence;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11231 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11232 tiff_memory_source *src = (tiff_memory_source *) data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11233 int idx;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11234
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11235 switch (whence)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11236 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11237 case SEEK_SET: /* Go from beginning of source. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11238 idx = off;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11239 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11240
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11241 case SEEK_END: /* Go from end of source. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11242 idx = src->len + off;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11243 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11244
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11245 case SEEK_CUR: /* Go from current position. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11246 idx = src->index + off;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11247 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11248
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11249 default: /* Invalid `whence'. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11250 return -1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11251 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11252
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11253 if (idx > src->len || idx < 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11254 return -1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11255
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11256 src->index = idx;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11257 return src->index;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11258 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11259
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11260 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11261 tiff_close_memory (data)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11262 thandle_t data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11263 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11264 /* NOOP */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11265 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11266 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11267
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11268 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11269 tiff_mmap_memory (data, pbase, psize)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11270 thandle_t data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11271 tdata_t *pbase;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11272 toff_t *psize;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11273 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11274 /* It is already _IN_ memory. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11275 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11276 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11277
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11278 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11279 tiff_unmap_memory (data, base, size)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11280 thandle_t data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11281 tdata_t base;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11282 toff_t size;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11283 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11284 /* We don't need to do this. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11285 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11286
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11287 static toff_t
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11288 tiff_size_of_memory (data)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11289 thandle_t data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11290 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11291 return ((tiff_memory_source *) data)->len;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11292 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11293
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11294 /* Load TIFF image IMG for use on frame F. Value is non-zero if
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11295 successful. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11296
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11297 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11298 tiff_load (f, img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11299 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11300 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11301 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11302 Lisp_Object file, specified_file;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11303 Lisp_Object specified_data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11304 TIFF *tiff;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11305 int width, height, x, y;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11306 uint32 *buf;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11307 int rc;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11308 XImage *ximg;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11309 struct gcpro gcpro1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11310 tiff_memory_source memsrc;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11311
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11312 specified_file = image_spec_value (img->spec, QCfile, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11313 specified_data = image_spec_value (img->spec, QCdata, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11314 file = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11315 GCPRO1 (file);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11316
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11317 if (NILP (specified_data))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11318 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11319 /* Read from a file */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11320 file = x_find_image_file (specified_file);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11321 if (!STRINGP (file))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11322 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11323 image_error ("Cannot find image file `%s'", file, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11324 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11325 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11326 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11327
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11328 /* Try to open the image file. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11329 tiff = TIFFOpen (XSTRING (file)->data, "r");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11330 if (tiff == NULL)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11331 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11332 image_error ("Cannot open `%s'", file, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11333 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11334 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11335 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11336 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11337 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11338 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11339 /* Memory source! */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11340 memsrc.bytes = XSTRING (specified_data)->data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11341 memsrc.len = STRING_BYTES (XSTRING (specified_data));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11342 memsrc.index = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11343
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11344 tiff = TIFFClientOpen ("memory_source", "r", &memsrc,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11345 (TIFFReadWriteProc) tiff_read_from_memory,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11346 (TIFFReadWriteProc) tiff_write_from_memory,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11347 tiff_seek_in_memory,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11348 tiff_close_memory,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11349 tiff_size_of_memory,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11350 tiff_mmap_memory,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11351 tiff_unmap_memory);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11352
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11353 if (!tiff)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11354 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11355 image_error ("Cannot open memory source for `%s'", img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11356 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11357 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11358 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11359 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11360
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11361 /* Get width and height of the image, and allocate a raster buffer
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11362 of width x height 32-bit values. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11363 TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11364 TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11365 buf = (uint32 *) xmalloc (width * height * sizeof *buf);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11366
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11367 rc = TIFFReadRGBAImage (tiff, width, height, buf, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11368 TIFFClose (tiff);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11369 if (!rc)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11370 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11371 image_error ("Error reading TIFF image `%s'", img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11372 xfree (buf);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11373 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11374 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11375 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11376
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11377 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11378
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11379 /* Create the X image and pixmap. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11380 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11381 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11382 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11383 xfree (buf);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11384 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11385 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11386 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11387
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11388 /* Initialize the color table. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11389 init_color_table ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11390
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11391 /* Process the pixel raster. Origin is in the lower-left corner. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11392 for (y = 0; y < height; ++y)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11393 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11394 uint32 *row = buf + y * width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11395
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11396 for (x = 0; x < width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11397 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11398 uint32 abgr = row[x];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11399 int r = TIFFGetR (abgr) << 8;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11400 int g = TIFFGetG (abgr) << 8;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11401 int b = TIFFGetB (abgr) << 8;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11402 XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11403 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11404 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11405
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11406 /* Remember the colors allocated for the image. Free the color table. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11407 img->colors = colors_in_color_table (&img->ncolors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11408 free_color_table ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11409
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11410 /* Put the image into the pixmap, then free the X image and its buffer. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11411 x_put_x_image (f, ximg, img->pixmap, width, height);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11412 x_destroy_x_image (ximg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11413 xfree (buf);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11414 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11415
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11416 img->width = width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11417 img->height = height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11418
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11419 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11420 return 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11421 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11422
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11423 #endif /* HAVE_TIFF != 0 */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11424
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11425
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11426
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11427 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11428 GIF
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11429 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11430
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11431 #if HAVE_GIF
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11432
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11433 #include <gif_lib.h>
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11434
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11435 static int gif_image_p P_ ((Lisp_Object object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11436 static int gif_load P_ ((struct frame *f, struct image *img));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11437
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11438 /* The symbol `gif' identifying images of this type. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11439
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11440 Lisp_Object Qgif;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11441
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11442 /* Indices of image specification fields in gif_format, below. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11443
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11444 enum gif_keyword_index
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11445 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11446 GIF_TYPE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11447 GIF_DATA,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11448 GIF_FILE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11449 GIF_ASCENT,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11450 GIF_MARGIN,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11451 GIF_RELIEF,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11452 GIF_ALGORITHM,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11453 GIF_HEURISTIC_MASK,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11454 GIF_IMAGE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11455 GIF_LAST
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11456 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11457
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11458 /* Vector of image_keyword structures describing the format
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11459 of valid user-defined image specifications. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11460
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11461 static struct image_keyword gif_format[GIF_LAST] =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11462 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11463 {":type", IMAGE_SYMBOL_VALUE, 1},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11464 {":data", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11465 {":file", IMAGE_STRING_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11466 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
11467 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11468 {":relief", IMAGE_INTEGER_VALUE, 0},
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
11469 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11470 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11471 {":image", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11472 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11473
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11474 /* Structure describing the image type `gif'. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11475
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11476 static struct image_type gif_type =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11477 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11478 &Qgif,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11479 gif_image_p,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11480 gif_load,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11481 x_clear_image,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11482 NULL
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11483 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11484
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11485 /* Return non-zero if OBJECT is a valid GIF image specification. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11486
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11487 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11488 gif_image_p (object)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11489 Lisp_Object object;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11490 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11491 struct image_keyword fmt[GIF_LAST];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11492 bcopy (gif_format, fmt, sizeof fmt);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11493
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11494 if (!parse_image_spec (object, fmt, GIF_LAST, Qgif)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11495 || (fmt[GIF_ASCENT].count
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11496 && XFASTINT (fmt[GIF_ASCENT].value) > 100))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11497 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11498
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11499 /* Must specify either the :data or :file keyword. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11500 return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11501 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11502
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11503 /* Reading a GIF image from memory
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11504 Based on the PNG memory stuff to a certain extent. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11505
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11506 typedef struct
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11507 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11508 unsigned char *bytes;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11509 size_t len;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11510 int index;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11511 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11512 gif_memory_source;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11513
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11514 /* Make the current memory source available to gif_read_from_memory.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11515 It's done this way because not all versions of libungif support
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11516 a UserData field in the GifFileType structure. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11517 static gif_memory_source *current_gif_memory_src;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11518
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11519 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11520 gif_read_from_memory (file, buf, len)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11521 GifFileType *file;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11522 GifByteType *buf;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11523 int len;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11524 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11525 gif_memory_source *src = current_gif_memory_src;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11526
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11527 if (len > src->len - src->index)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11528 return -1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11529
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11530 bcopy (src->bytes + src->index, buf, len);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11531 src->index += len;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11532 return len;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11533 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11534
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11535
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11536 /* Load GIF image IMG for use on frame F. Value is non-zero if
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11537 successful. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11538
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11539 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11540 gif_load (f, img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11541 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11542 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11543 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11544 Lisp_Object file, specified_file;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11545 Lisp_Object specified_data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11546 int rc, width, height, x, y, i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11547 XImage *ximg;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11548 ColorMapObject *gif_color_map;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11549 unsigned long pixel_colors[256];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11550 GifFileType *gif;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11551 struct gcpro gcpro1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11552 Lisp_Object image;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11553 int ino, image_left, image_top, image_width, image_height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11554 gif_memory_source memsrc;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11555 unsigned char *raster;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11556
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11557 specified_file = image_spec_value (img->spec, QCfile, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11558 specified_data = image_spec_value (img->spec, QCdata, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11559 file = Qnil;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
11560 GCPRO1 (file);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11561
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11562 if (NILP (specified_data))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11563 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11564 file = x_find_image_file (specified_file);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11565 if (!STRINGP (file))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11566 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11567 image_error ("Cannot find image file `%s'", specified_file, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11568 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11569 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11570 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11571
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11572 /* Open the GIF file. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11573 gif = DGifOpenFileName (XSTRING (file)->data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11574 if (gif == NULL)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11575 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11576 image_error ("Cannot open `%s'", file, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11577 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11578 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11579 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11580 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11581 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11582 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11583 /* Read from memory! */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11584 current_gif_memory_src = &memsrc;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11585 memsrc.bytes = XSTRING (specified_data)->data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11586 memsrc.len = STRING_BYTES (XSTRING (specified_data));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11587 memsrc.index = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11588
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11589 gif = DGifOpen(&memsrc, gif_read_from_memory);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11590 if (!gif)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11591 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11592 image_error ("Cannot open memory source `%s'", img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11593 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11594 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11595 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11596 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11597
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11598 /* Read entire contents. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11599 rc = DGifSlurp (gif);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11600 if (rc == GIF_ERROR)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11601 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11602 image_error ("Error reading `%s'", img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11603 DGifCloseFile (gif);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11604 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11605 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11606 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11607
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11608 image = image_spec_value (img->spec, QCindex, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11609 ino = INTEGERP (image) ? XFASTINT (image) : 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11610 if (ino >= gif->ImageCount)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11611 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11612 image_error ("Invalid image number `%s' in image `%s'",
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11613 image, img->spec);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11614 DGifCloseFile (gif);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11615 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11616 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11617 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11618
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11619 width = img->width = gif->SWidth;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11620 height = img->height = gif->SHeight;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11621
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11622 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11623
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11624 /* Create the X image and pixmap. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11625 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11626 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11627 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11628 DGifCloseFile (gif);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11629 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11630 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11631 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11632
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11633 /* Allocate colors. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11634 gif_color_map = gif->SavedImages[ino].ImageDesc.ColorMap;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11635 if (!gif_color_map)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11636 gif_color_map = gif->SColorMap;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11637 init_color_table ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11638 bzero (pixel_colors, sizeof pixel_colors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11639
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11640 for (i = 0; i < gif_color_map->ColorCount; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11641 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11642 int r = gif_color_map->Colors[i].Red << 8;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11643 int g = gif_color_map->Colors[i].Green << 8;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11644 int b = gif_color_map->Colors[i].Blue << 8;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11645 pixel_colors[i] = lookup_rgb_color (f, r, g, b);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11646 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11647
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11648 img->colors = colors_in_color_table (&img->ncolors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11649 free_color_table ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11650
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11651 /* Clear the part of the screen image that are not covered by
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11652 the image from the GIF file. Full animated GIF support
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11653 requires more than can be done here (see the gif89 spec,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11654 disposal methods). Let's simply assume that the part
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11655 not covered by a sub-image is in the frame's background color. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11656 image_top = gif->SavedImages[ino].ImageDesc.Top;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11657 image_left = gif->SavedImages[ino].ImageDesc.Left;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11658 image_width = gif->SavedImages[ino].ImageDesc.Width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11659 image_height = gif->SavedImages[ino].ImageDesc.Height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11660
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11661 for (y = 0; y < image_top; ++y)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11662 for (x = 0; x < width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11663 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11664
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11665 for (y = image_top + image_height; y < height; ++y)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11666 for (x = 0; x < width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11667 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11668
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11669 for (y = image_top; y < image_top + image_height; ++y)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11670 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11671 for (x = 0; x < image_left; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11672 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11673 for (x = image_left + image_width; x < width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11674 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11675 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11676
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11677 /* Read the GIF image into the X image. We use a local variable
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11678 `raster' here because RasterBits below is a char *, and invites
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11679 problems with bytes >= 0x80. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11680 raster = (unsigned char *) gif->SavedImages[ino].RasterBits;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11681
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11682 if (gif->SavedImages[ino].ImageDesc.Interlace)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11683 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11684 static int interlace_start[] = {0, 4, 2, 1};
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11685 static int interlace_increment[] = {8, 8, 4, 2};
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11686 int pass, inc;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11687 int row = interlace_start[0];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11688
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11689 pass = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11690
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11691 for (y = 0; y < image_height; y++)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11692 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11693 if (row >= image_height)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11694 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11695 row = interlace_start[++pass];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11696 while (row >= image_height)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11697 row = interlace_start[++pass];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11698 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11699
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11700 for (x = 0; x < image_width; x++)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11701 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11702 int i = raster[(y * image_width) + x];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11703 XPutPixel (ximg, x + image_left, row + image_top,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11704 pixel_colors[i]);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11705 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11706
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11707 row += interlace_increment[pass];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11708 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11709 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11710 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11711 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11712 for (y = 0; y < image_height; ++y)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11713 for (x = 0; x < image_width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11714 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11715 int i = raster[y* image_width + x];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11716 XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11717 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11718 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11719
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11720 DGifCloseFile (gif);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11721
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11722 /* Put the image into the pixmap, then free the X image and its buffer. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11723 x_put_x_image (f, ximg, img->pixmap, width, height);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11724 x_destroy_x_image (ximg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11725 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11726
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11727 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11728 return 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11729 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11730
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11731 #endif /* HAVE_GIF != 0 */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11732
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11733
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11734
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11735 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11736 Ghostscript
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11737 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11738
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11739 #ifdef HAVE_GHOSTSCRIPT
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11740 static int gs_image_p P_ ((Lisp_Object object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11741 static int gs_load P_ ((struct frame *f, struct image *img));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11742 static void gs_clear_image P_ ((struct frame *f, struct image *img));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11743
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11744 /* The symbol `postscript' identifying images of this type. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11745
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11746 Lisp_Object Qpostscript;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11747
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11748 /* Keyword symbols. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11749
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11750 Lisp_Object QCloader, QCbounding_box, QCpt_width, QCpt_height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11751
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11752 /* Indices of image specification fields in gs_format, below. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11753
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11754 enum gs_keyword_index
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11755 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11756 GS_TYPE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11757 GS_PT_WIDTH,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11758 GS_PT_HEIGHT,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11759 GS_FILE,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11760 GS_LOADER,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11761 GS_BOUNDING_BOX,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11762 GS_ASCENT,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11763 GS_MARGIN,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11764 GS_RELIEF,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11765 GS_ALGORITHM,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11766 GS_HEURISTIC_MASK,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11767 GS_LAST
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11768 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11769
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11770 /* Vector of image_keyword structures describing the format
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11771 of valid user-defined image specifications. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11772
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11773 static struct image_keyword gs_format[GS_LAST] =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11774 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11775 {":type", IMAGE_SYMBOL_VALUE, 1},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11776 {":pt-width", IMAGE_POSITIVE_INTEGER_VALUE, 1},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11777 {":pt-height", IMAGE_POSITIVE_INTEGER_VALUE, 1},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11778 {":file", IMAGE_STRING_VALUE, 1},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11779 {":loader", IMAGE_FUNCTION_VALUE, 0},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11780 {":bounding-box", IMAGE_DONT_CHECK_VALUE_TYPE, 1},
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11781 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
11782 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11783 {":relief", IMAGE_INTEGER_VALUE, 0},
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
11784 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11785 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11786 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11787
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11788 /* Structure describing the image type `ghostscript'. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11789
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11790 static struct image_type gs_type =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11791 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11792 &Qpostscript,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11793 gs_image_p,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11794 gs_load,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11795 gs_clear_image,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11796 NULL
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11797 };
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11798
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11799
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11800 /* Free X resources of Ghostscript image IMG which is used on frame F. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11801
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11802 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11803 gs_clear_image (f, img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11804 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11805 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11806 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11807 /* IMG->data.ptr_val may contain a recorded colormap. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11808 xfree (img->data.ptr_val);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11809 x_clear_image (f, img);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11810 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11811
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11812
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11813 /* Return non-zero if OBJECT is a valid Ghostscript image
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11814 specification. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11815
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11816 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11817 gs_image_p (object)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11818 Lisp_Object object;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11819 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11820 struct image_keyword fmt[GS_LAST];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11821 Lisp_Object tem;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11822 int i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11823
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11824 bcopy (gs_format, fmt, sizeof fmt);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11825
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11826 if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11827 || (fmt[GS_ASCENT].count
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11828 && XFASTINT (fmt[GS_ASCENT].value) > 100))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11829 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11830
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11831 /* Bounding box must be a list or vector containing 4 integers. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11832 tem = fmt[GS_BOUNDING_BOX].value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11833 if (CONSP (tem))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11834 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11835 for (i = 0; i < 4; ++i, tem = XCDR (tem))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11836 if (!CONSP (tem) || !INTEGERP (XCAR (tem)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11837 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11838 if (!NILP (tem))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11839 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11840 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11841 else if (VECTORP (tem))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11842 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11843 if (XVECTOR (tem)->size != 4)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11844 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11845 for (i = 0; i < 4; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11846 if (!INTEGERP (XVECTOR (tem)->contents[i]))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11847 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11848 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11849 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11850 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11851
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11852 return 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11853 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11854
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11855
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11856 /* Load Ghostscript image IMG for use on frame F. Value is non-zero
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11857 if successful. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11858
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11859 static int
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11860 gs_load (f, img)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11861 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11862 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11863 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11864 char buffer[100];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11865 Lisp_Object window_and_pixmap_id = Qnil, loader, pt_height, pt_width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11866 struct gcpro gcpro1, gcpro2;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11867 Lisp_Object frame;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11868 double in_width, in_height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11869 Lisp_Object pixel_colors = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11870
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11871 /* Compute pixel size of pixmap needed from the given size in the
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11872 image specification. Sizes in the specification are in pt. 1 pt
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11873 = 1/72 in, xdpi and ydpi are stored in the frame's X display
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11874 info. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11875 pt_width = image_spec_value (img->spec, QCpt_width, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11876 in_width = XFASTINT (pt_width) / 72.0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11877 img->width = in_width * FRAME_W32_DISPLAY_INFO (f)->resx;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11878 pt_height = image_spec_value (img->spec, QCpt_height, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11879 in_height = XFASTINT (pt_height) / 72.0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11880 img->height = in_height * FRAME_W32_DISPLAY_INFO (f)->resy;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11881
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11882 /* Create the pixmap. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11883 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11884 xassert (img->pixmap == 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11885 img->pixmap = XCreatePixmap (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11886 img->width, img->height,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11887 DefaultDepthOfScreen (FRAME_X_SCREEN (f)));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11888 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11889
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11890 if (!img->pixmap)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11891 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11892 image_error ("Unable to create pixmap for `%s'", img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11893 return 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11894 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11895
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11896 /* Call the loader to fill the pixmap. It returns a process object
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11897 if successful. We do not record_unwind_protect here because
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11898 other places in redisplay like calling window scroll functions
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11899 don't either. Let the Lisp loader use `unwind-protect' instead. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11900 GCPRO2 (window_and_pixmap_id, pixel_colors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11901
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11902 sprintf (buffer, "%lu %lu",
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11903 (unsigned long) FRAME_W32_WINDOW (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11904 (unsigned long) img->pixmap);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11905 window_and_pixmap_id = build_string (buffer);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11906
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11907 sprintf (buffer, "%lu %lu",
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11908 FRAME_FOREGROUND_PIXEL (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11909 FRAME_BACKGROUND_PIXEL (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11910 pixel_colors = build_string (buffer);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11911
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11912 XSETFRAME (frame, f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11913 loader = image_spec_value (img->spec, QCloader, NULL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11914 if (NILP (loader))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11915 loader = intern ("gs-load-image");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11916
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11917 img->data.lisp_val = call6 (loader, frame, img->spec,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11918 make_number (img->width),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11919 make_number (img->height),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11920 window_and_pixmap_id,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11921 pixel_colors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11922 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11923 return PROCESSP (img->data.lisp_val);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11924 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11925
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11926
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11927 /* Kill the Ghostscript process that was started to fill PIXMAP on
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11928 frame F. Called from XTread_socket when receiving an event
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11929 telling Emacs that Ghostscript has finished drawing. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11930
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11931 void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11932 x_kill_gs_process (pixmap, f)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11933 Pixmap pixmap;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11934 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11935 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11936 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11937 int class, i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11938 struct image *img;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11939
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11940 /* Find the image containing PIXMAP. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11941 for (i = 0; i < c->used; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11942 if (c->images[i]->pixmap == pixmap)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11943 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11944
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11945 /* Kill the GS process. We should have found PIXMAP in the image
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11946 cache and its image should contain a process object. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11947 xassert (i < c->used);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11948 img = c->images[i];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11949 xassert (PROCESSP (img->data.lisp_val));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11950 Fkill_process (img->data.lisp_val, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11951 img->data.lisp_val = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11952
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11953 /* On displays with a mutable colormap, figure out the colors
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11954 allocated for the image by looking at the pixels of an XImage for
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11955 img->pixmap. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11956 class = FRAME_W32_DISPLAY_INFO (f)->visual->class;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11957 if (class != StaticColor && class != StaticGray && class != TrueColor)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11958 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11959 XImage *ximg;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11960
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11961 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11962
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11963 /* Try to get an XImage for img->pixmep. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11964 ximg = XGetImage (FRAME_W32_DISPLAY (f), img->pixmap,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11965 0, 0, img->width, img->height, ~0, ZPixmap);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11966 if (ximg)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11967 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11968 int x, y;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11969
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11970 /* Initialize the color table. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11971 init_color_table ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11972
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11973 /* For each pixel of the image, look its color up in the
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11974 color table. After having done so, the color table will
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11975 contain an entry for each color used by the image. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11976 for (y = 0; y < img->height; ++y)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11977 for (x = 0; x < img->width; ++x)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11978 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11979 unsigned long pixel = XGetPixel (ximg, x, y);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11980 lookup_pixel_color (f, pixel);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11981 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11982
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11983 /* Record colors in the image. Free color table and XImage. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11984 img->colors = colors_in_color_table (&img->ncolors);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11985 free_color_table ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11986 XDestroyImage (ximg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11987
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11988 #if 0 /* This doesn't seem to be the case. If we free the colors
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11989 here, we get a BadAccess later in x_clear_image when
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11990 freeing the colors. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11991 /* We have allocated colors once, but Ghostscript has also
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11992 allocated colors on behalf of us. So, to get the
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11993 reference counts right, free them once. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11994 if (img->ncolors)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11995 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11996 Colormap cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11997 XFreeColors (FRAME_W32_DISPLAY (f), cmap,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11998 img->colors, img->ncolors, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
11999 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12000 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12001 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12002 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12003 image_error ("Cannot get X image of `%s'; colors will not be freed",
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12004 img->spec, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12005
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12006 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12007 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12008 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12009
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12010 #endif /* HAVE_GHOSTSCRIPT */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12011
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12012
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12013 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12014 Window properties
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12015 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12016
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12017 DEFUN ("x-change-window-property", Fx_change_window_property,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12018 Sx_change_window_property, 2, 3, 0,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12019 "Change window property PROP to VALUE on the X window of FRAME.\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12020 PROP and VALUE must be strings. FRAME nil or omitted means use the\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12021 selected frame. Value is VALUE.")
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12022 (prop, value, frame)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12023 Lisp_Object frame, prop, value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12024 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12025 #if 0 /* TODO : port window properties to W32 */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12026 struct frame *f = check_x_frame (frame);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12027 Atom prop_atom;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12028
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12029 CHECK_STRING (prop, 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12030 CHECK_STRING (value, 2);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12031
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12032 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12033 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12034 XChangeProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12035 prop_atom, XA_STRING, 8, PropModeReplace,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12036 XSTRING (value)->data, XSTRING (value)->size);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12037
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12038 /* Make sure the property is set when we return. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12039 XFlush (FRAME_W32_DISPLAY (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12040 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12041
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12042 #endif /* TODO */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12043
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12044 return value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12045 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12046
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12047
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12048 DEFUN ("x-delete-window-property", Fx_delete_window_property,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12049 Sx_delete_window_property, 1, 2, 0,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12050 "Remove window property PROP from X window of FRAME.\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12051 FRAME nil or omitted means use the selected frame. Value is PROP.")
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12052 (prop, frame)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12053 Lisp_Object prop, frame;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12054 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12055 #if 0 /* TODO : port window properties to W32 */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12056
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12057 struct frame *f = check_x_frame (frame);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12058 Atom prop_atom;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12059
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12060 CHECK_STRING (prop, 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12061 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12062 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12063 XDeleteProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12064
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12065 /* Make sure the property is removed when we return. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12066 XFlush (FRAME_W32_DISPLAY (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12067 UNBLOCK_INPUT;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12068 #endif /* TODO */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12069
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12070 return prop;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12071 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12072
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12073
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12074 DEFUN ("x-window-property", Fx_window_property, Sx_window_property,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12075 1, 2, 0,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12076 "Value is the value of window property PROP on FRAME.\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12077 If FRAME is nil or omitted, use the selected frame. Value is nil\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12078 if FRAME hasn't a property with name PROP or if PROP has no string\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12079 value.")
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12080 (prop, frame)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12081 Lisp_Object prop, frame;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12082 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12083 #if 0 /* TODO : port window properties to W32 */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12084
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12085 struct frame *f = check_x_frame (frame);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12086 Atom prop_atom;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12087 int rc;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12088 Lisp_Object prop_value = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12089 char *tmp_data = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12090 Atom actual_type;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12091 int actual_format;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12092 unsigned long actual_size, bytes_remaining;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12093
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12094 CHECK_STRING (prop, 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12095 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12096 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12097 rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12098 prop_atom, 0, 0, False, XA_STRING,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12099 &actual_type, &actual_format, &actual_size,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12100 &bytes_remaining, (unsigned char **) &tmp_data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12101 if (rc == Success)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12102 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12103 int size = bytes_remaining;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12104
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12105 XFree (tmp_data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12106 tmp_data = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12107
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12108 rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12109 prop_atom, 0, bytes_remaining,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12110 False, XA_STRING,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12111 &actual_type, &actual_format,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12112 &actual_size, &bytes_remaining,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12113 (unsigned char **) &tmp_data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12114 if (rc == Success)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12115 prop_value = make_string (tmp_data, size);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12116
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12117 XFree (tmp_data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12118 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12119
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12120 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12121
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12122 return prop_value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12123
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12124 #endif /* TODO */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12125 return Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12126 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12127
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12128
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12129
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12130 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12131 Busy cursor
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12132 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12133
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12134 /* 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: 36080
diff changeset
12135 an hourglass cursor on all frames. */
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12136
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12137 static struct atimer *hourglass_atimer;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12138
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12139 /* Non-zero means an hourglass cursor is currently shown. */
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12140
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12141 static int hourglass_shown_p;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12142
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12143 /* Number of seconds to wait before displaying an hourglass cursor. */
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12144
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12145 static Lisp_Object Vhourglass_delay;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12146
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12147 /* Default number of seconds to wait before displaying an hourglass
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12148 cursor. */
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12149
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12150 #define DEFAULT_HOURGLASS_DELAY 1
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12151
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12152 /* Function prototypes. */
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12153
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12154 static void show_hourglass P_ ((struct atimer *));
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12155 static void hide_hourglass P_ ((void));
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12156
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12157
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12158 /* Cancel a currently active hourglass timer, and start a new one. */
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12159
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12160 void
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12161 start_hourglass ()
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12162 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12163 #if 0 /* TODO: cursor shape changes. */
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12164 EMACS_TIME delay;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
12165 int secs, usecs = 0;
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12166
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12167 cancel_hourglass ();
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12168
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12169 if (INTEGERP (Vhourglass_delay)
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12170 && XINT (Vhourglass_delay) > 0)
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12171 secs = XFASTINT (Vhourglass_delay);
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12172 else if (FLOATP (Vhourglass_delay)
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12173 && XFLOAT_DATA (Vhourglass_delay) > 0)
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
12174 {
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
12175 Lisp_Object tem;
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12176 tem = Ftruncate (Vhourglass_delay, Qnil);
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
12177 secs = XFASTINT (tem);
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12178 usecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000000;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12179 }
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12180 else
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12181 secs = DEFAULT_HOURGLASS_DELAY;
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12182
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
12183 EMACS_SET_SECS_USECS (delay, secs, usecs);
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12184 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12185 show_hourglass, NULL);
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12186 #endif
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12187 }
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12188
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12189
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12190 /* Cancel the hourglass cursor timer if active, hide an hourglass
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12191 cursor if shown. */
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12192
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12193 void
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12194 cancel_hourglass ()
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12195 {
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12196 if (hourglass_atimer)
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12197 {
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12198 cancel_atimer (hourglass_atimer);
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12199 hourglass_atimer = NULL;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12200 }
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12201
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12202 if (hourglass_shown_p)
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12203 hide_hourglass ();
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12204 }
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12205
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12206
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12207 /* Timer function of hourglass_atimer. TIMER is equal to
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12208 hourglass_atimer.
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12209
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12210 Display an hourglass cursor on all frames by mapping the frames'
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12211 hourglass_window. Set the hourglass_p flag in the frames'
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12212 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: 36080
diff changeset
12213 shown on the frames. */
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12214
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12215 static void
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12216 show_hourglass (timer)
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12217 struct atimer *timer;
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12218 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12219 #if 0 /* TODO: cursor shape changes. */
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12220 /* The timer implementation will cancel this timer automatically
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12221 after this function has run. Set hourglass_atimer to null
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12222 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: 36080
diff changeset
12223 hourglass_atimer = NULL;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12224
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12225 if (!hourglass_shown_p)
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12226 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12227 Lisp_Object rest, frame;
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12228
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12229 BLOCK_INPUT;
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12230
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12231 FOR_EACH_FRAME (rest, frame)
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12232 if (FRAME_W32_P (XFRAME (frame)))
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12233 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12234 struct frame *f = XFRAME (frame);
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12235
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12236 f->output_data.w32->hourglass_p = 1;
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12237
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12238 if (!f->output_data.w32->hourglass_window)
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12239 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12240 unsigned long mask = CWCursor;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12241 XSetWindowAttributes attrs;
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12242
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12243 attrs.cursor = f->output_data.w32->hourglass_cursor;
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12244
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12245 f->output_data.w32->hourglass_window
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12246 = XCreateWindow (FRAME_X_DISPLAY (f),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12247 FRAME_OUTER_WINDOW (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12248 0, 0, 32000, 32000, 0, 0,
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12249 InputOnly,
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12250 CopyFromParent,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12251 mask, &attrs);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12252 }
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12253
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12254 XMapRaised (FRAME_X_DISPLAY (f),
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12255 f->output_data.w32->hourglass_window);
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12256 XFlush (FRAME_X_DISPLAY (f));
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12257 }
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12258
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12259 hourglass_shown_p = 1;
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12260 UNBLOCK_INPUT;
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12261 }
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12262 #endif
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12263 }
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12264
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12265
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12266 /* Hide the hourglass cursor on all frames, if it is currently shown. */
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12267
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12268 static void
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12269 hide_hourglass ()
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12270 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12271 #if 0 /* TODO: cursor shape changes. */
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12272 if (hourglass_shown_p)
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12273 {
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12274 Lisp_Object rest, frame;
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12275
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12276 BLOCK_INPUT;
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12277 FOR_EACH_FRAME (rest, frame)
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12278 {
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12279 struct frame *f = XFRAME (frame);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12280
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12281 if (FRAME_W32_P (f)
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12282 /* Watch out for newly created frames. */
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12283 && f->output_data.x->hourglass_window)
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12284 {
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12285 XUnmapWindow (FRAME_X_DISPLAY (f),
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12286 f->output_data.x->hourglass_window);
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12287 /* Sync here because XTread_socket looks at the
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12288 hourglass_p flag that is reset to zero below. */
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12289 XSync (FRAME_X_DISPLAY (f), False);
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12290 f->output_data.x->hourglass_p = 0;
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12291 }
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12292 }
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12293
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
12294 hourglass_shown_p = 0;
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12295 UNBLOCK_INPUT;
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
12296 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12297 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12298 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12299
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12300
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12301
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12302 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12303 Tool tips
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12304 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12305
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12306 static Lisp_Object x_create_tip_frame P_ ((struct w32_display_info *,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12307 Lisp_Object));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12308
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12309 /* The frame of a currently visible tooltip, or null. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12310
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12311 Lisp_Object tip_frame;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12312
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12313 /* If non-nil, a timer started that hides the last tooltip when it
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12314 fires. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12315
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12316 Lisp_Object tip_timer;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12317 Window tip_window;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12318
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12319 static Lisp_Object
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12320 unwind_create_tip_frame (frame)
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12321 Lisp_Object frame;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12322 {
34638
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
12323 Lisp_Object deleted;
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
12324
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
12325 deleted = unwind_create_frame (frame);
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
12326 if (EQ (deleted, Qt))
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
12327 {
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
12328 tip_window = NULL;
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
12329 tip_frame = Qnil;
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
12330 }
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
12331
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
12332 return deleted;
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12333 }
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12334
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12335
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12336 /* Create a frame for a tooltip on the display described by DPYINFO.
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12337 PARMS is a list of frame parameters. Value is the frame.
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12338
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12339 Note that functions called here, esp. x_default_parameter can
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12340 signal errors, for instance when a specified color name is
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12341 undefined. We have to make sure that we're in a consistent state
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12342 when this happens. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12343
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12344 static Lisp_Object
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12345 x_create_tip_frame (dpyinfo, parms)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12346 struct w32_display_info *dpyinfo;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12347 Lisp_Object parms;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12348 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12349 #if 0 /* TODO : w32 version */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12350 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12351 Lisp_Object frame, tem;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12352 Lisp_Object name;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12353 long window_prompting = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12354 int width, height;
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12355 int count = BINDING_STACK_SIZE ();
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12356 struct gcpro gcpro1, gcpro2, gcpro3;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12357 struct kboard *kb;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12358
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12359 check_x ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12360
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12361 /* Use this general default value to start with until we know if
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12362 this frame has a specified name. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12363 Vx_resource_name = Vinvocation_name;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12364
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12365 #ifdef MULTI_KBOARD
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12366 kb = dpyinfo->kboard;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12367 #else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12368 kb = &the_only_kboard;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12369 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12370
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12371 /* Get the name of the frame to use for resource lookup. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12372 name = w32_get_arg (parms, Qname, "name", "Name", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12373 if (!STRINGP (name)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12374 && !EQ (name, Qunbound)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12375 && !NILP (name))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12376 error ("Invalid frame name--not a string or nil");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12377 Vx_resource_name = name;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12378
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12379 frame = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12380 GCPRO3 (parms, name, frame);
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12381 f = make_frame (1);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12382 XSETFRAME (frame, f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12383 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12384 record_unwind_protect (unwind_create_tip_frame, frame);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12385
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
12386 f->output_method = output_w32;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12387 f->output_data.w32 =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12388 (struct w32_output *) xmalloc (sizeof (struct w32_output));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12389 bzero (f->output_data.w32, sizeof (struct w32_output));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12390 #if 0
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12391 f->output_data.w32->icon_bitmap = -1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12392 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12393 f->output_data.w32->fontset = -1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12394 f->icon_name = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12395
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12396 #ifdef GLYPH_DEBUG
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12397 image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12398 dpyinfo_refcount = dpyinfo->reference_count;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12399 #endif /* GLYPH_DEBUG */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12400 #ifdef MULTI_KBOARD
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12401 FRAME_KBOARD (f) = kb;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12402 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12403 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12404 f->output_data.w32->explicit_parent = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12405
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12406 /* Set the name; the functions to which we pass f expect the name to
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12407 be set. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12408 if (EQ (name, Qunbound) || NILP (name))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12409 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12410 f->name = build_string (dpyinfo->x_id_name);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12411 f->explicit_name = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12412 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12413 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12414 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12415 f->name = name;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12416 f->explicit_name = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12417 /* use the frame's title when getting resources for this frame. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12418 specbind (Qx_resource_name, name);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12419 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12420
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12421 /* Extract the window parameters from the supplied values
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12422 that are needed to determine window geometry. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12423 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12424 Lisp_Object font;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12425
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12426 font = w32_get_arg (parms, Qfont, "font", "Font", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12427
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12428 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12429 /* First, try whatever font the caller has specified. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12430 if (STRINGP (font))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12431 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12432 tem = Fquery_fontset (font, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12433 if (STRINGP (tem))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12434 font = x_new_fontset (f, XSTRING (tem)->data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12435 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12436 font = x_new_font (f, XSTRING (font)->data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12437 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12438
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12439 /* Try out a font which we hope has bold and italic variations. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12440 if (!STRINGP (font))
32977
d0421102ed8c (Fx_create_frame): Make default fontsize on w32 10 point, as Windows
Jason Rumney <jasonr@gnu.org>
parents: 32791
diff changeset
12441 font = x_new_font (f, "-*-courier new-normal-r-*-*-*-100-*-*-*-*-iso8859-1");
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12442 if (!STRINGP (font))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12443 font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12444 if (! STRINGP (font))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12445 font = x_new_font (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12446 if (! STRINGP (font))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12447 /* This was formerly the first thing tried, but it finds too many fonts
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12448 and takes too long. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12449 font = x_new_font (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12450 /* If those didn't work, look for something which will at least work. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12451 if (! STRINGP (font))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12452 font = x_new_font (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12453 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12454 if (! STRINGP (font))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12455 font = build_string ("fixed");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12456
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12457 x_default_parameter (f, parms, Qfont, font,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12458 "font", "Font", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12459 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12460
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12461 x_default_parameter (f, parms, Qborder_width, make_number (2),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12462 "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12463
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12464 /* This defaults to 2 in order to match xterm. We recognize either
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12465 internalBorderWidth or internalBorder (which is what xterm calls
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12466 it). */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12467 if (NILP (Fassq (Qinternal_border_width, parms)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12468 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12469 Lisp_Object value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12470
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12471 value = w32_get_arg (parms, Qinternal_border_width,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12472 "internalBorder", "internalBorder", RES_TYPE_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12473 if (! EQ (value, Qunbound))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12474 parms = Fcons (Fcons (Qinternal_border_width, value),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12475 parms);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12476 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12477
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12478 x_default_parameter (f, parms, Qinternal_border_width, make_number (1),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12479 "internalBorderWidth", "internalBorderWidth",
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12480 RES_TYPE_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12481
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12482 /* Also do the stuff which must be set before the window exists. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12483 x_default_parameter (f, parms, Qforeground_color, build_string ("black"),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12484 "foreground", "Foreground", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12485 x_default_parameter (f, parms, Qbackground_color, build_string ("white"),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12486 "background", "Background", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12487 x_default_parameter (f, parms, Qmouse_color, build_string ("black"),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12488 "pointerColor", "Foreground", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12489 x_default_parameter (f, parms, Qcursor_color, build_string ("black"),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12490 "cursorColor", "Foreground", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12491 x_default_parameter (f, parms, Qborder_color, build_string ("black"),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12492 "borderColor", "BorderColor", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12493
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12494 /* Init faces before x_default_parameter is called for scroll-bar
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12495 parameters because that function calls x_set_scroll_bar_width,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12496 which calls change_frame_size, which calls Fset_window_buffer,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12497 which runs hooks, which call Fvertical_motion. At the end, we
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12498 end up in init_iterator with a null face cache, which should not
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12499 happen. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12500 init_frame_faces (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12501
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12502 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12503 window_prompting = x_figure_window_size (f, parms);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12504
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12505 if (window_prompting & XNegative)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12506 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12507 if (window_prompting & YNegative)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12508 f->output_data.w32->win_gravity = SouthEastGravity;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12509 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12510 f->output_data.w32->win_gravity = NorthEastGravity;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12511 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12512 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12513 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12514 if (window_prompting & YNegative)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12515 f->output_data.w32->win_gravity = SouthWestGravity;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12516 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12517 f->output_data.w32->win_gravity = NorthWestGravity;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12518 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12519
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12520 f->output_data.w32->size_hint_flags = window_prompting;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12521 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12522 XSetWindowAttributes attrs;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12523 unsigned long mask;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12524
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12525 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12526 mask = CWBackPixel | CWOverrideRedirect | CWSaveUnder | CWEventMask;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12527 /* Window managers looks at the override-redirect flag to
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12528 determine whether or net to give windows a decoration (Xlib
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12529 3.2.8). */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12530 attrs.override_redirect = True;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12531 attrs.save_under = True;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12532 attrs.background_pixel = FRAME_BACKGROUND_PIXEL (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12533 /* Arrange for getting MapNotify and UnmapNotify events. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12534 attrs.event_mask = StructureNotifyMask;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12535 tip_window
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12536 = FRAME_W32_WINDOW (f)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12537 = XCreateWindow (FRAME_W32_DISPLAY (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12538 FRAME_W32_DISPLAY_INFO (f)->root_window,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12539 /* x, y, width, height */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12540 0, 0, 1, 1,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12541 /* Border. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12542 1,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12543 CopyFromParent, InputOutput, CopyFromParent,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12544 mask, &attrs);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12545 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12546 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12547
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12548 x_make_gc (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12549
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12550 x_default_parameter (f, parms, Qauto_raise, Qnil,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12551 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12552 x_default_parameter (f, parms, Qauto_lower, Qnil,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12553 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12554 x_default_parameter (f, parms, Qcursor_type, Qbox,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12555 "cursorType", "CursorType", RES_TYPE_SYMBOL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12556
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12557 /* Dimensions, especially f->height, must be done via change_frame_size.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12558 Change will not be effected unless different from the current
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12559 f->height. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12560 width = f->width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12561 height = f->height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12562 f->height = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12563 SET_FRAME_WIDTH (f, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12564 change_frame_size (f, height, width, 1, 0, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12565
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12566 f->no_split = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12567
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12568 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12569
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12570 /* It is now ok to make the frame official even if we get an error
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12571 below. And the frame needs to be on Vframe_list or making it
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12572 visible won't work. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12573 Vframe_list = Fcons (frame, Vframe_list);
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12574 tip_frame = frame;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12575
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12576 /* Now that the frame is official, it counts as a reference to
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12577 its display. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12578 FRAME_W32_DISPLAY_INFO (f)->reference_count++;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12579
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12580 return unbind_to (count, frame);
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12581 #endif /* TODO */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12582 return Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12583 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12584
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12585 #ifdef TODO /* Tooltip support not complete. */
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12586 DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12587 "Show STRING in a \"tooltip\" window on frame FRAME.\n\
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12588 A tooltip window is a small window displaying a string.\n\
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12589 \n\
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12590 FRAME nil or omitted means use the selected frame.\n\
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12591 \n\
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12592 PARMS is an optional list of frame parameters which can be\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12593 used to change the tooltip's appearance.\n\
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12594 \n\
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12595 Automatically hide the tooltip after TIMEOUT seconds.\n\
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12596 TIMEOUT nil means use the default timeout of 5 seconds.\n\
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12597 \n\
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12598 If the list of frame parameters PARAMS contains a `left' parameters,\n\
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12599 the tooltip is displayed at that x-position. Otherwise it is\n\
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12600 displayed at the mouse position, with offset DX added (default is 5 if\n\
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12601 DX isn't specified). Likewise for the y-position; if a `top' frame\n\
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12602 parameter is specified, it determines the y-position of the tooltip\n\
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12603 window, otherwise it is displayed at the mouse position, with offset\n\
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12604 DY added (default is 10).")
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12605 (string, frame, parms, timeout, dx, dy)
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12606 Lisp_Object string, frame, parms, timeout, dx, dy;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12607 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12608 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12609 struct window *w;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12610 Window root, child;
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12611 Lisp_Object buffer, top, left;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12612 struct buffer *old_buffer;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12613 struct text_pos pos;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12614 int i, width, height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12615 int root_x, root_y, win_x, win_y;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12616 unsigned pmask;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12617 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12618 int old_windows_or_buffers_changed = windows_or_buffers_changed;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12619 int count = specpdl_ptr - specpdl;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12620
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12621 specbind (Qinhibit_redisplay, Qt);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12622
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
12623 GCPRO4 (string, parms, frame, timeout);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12624
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12625 CHECK_STRING (string, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12626 f = check_x_frame (frame);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12627 if (NILP (timeout))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12628 timeout = make_number (5);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12629 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12630 CHECK_NATNUM (timeout, 2);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12631
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12632 if (NILP (dx))
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12633 dx = make_number (5);
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12634 else
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12635 CHECK_NUMBER (dx, 5);
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12636
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12637 if (NILP (dy))
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12638 dy = make_number (-10);
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12639 else
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12640 CHECK_NUMBER (dy, 6);
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12641
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12642 if (NILP (last_show_tip_args))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12643 last_show_tip_args = Fmake_vector (make_number (3), Qnil);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12644
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12645 if (!NILP (tip_frame))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12646 {
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12647 Lisp_Object last_string = AREF (last_show_tip_args, 0);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12648 Lisp_Object last_frame = AREF (last_show_tip_args, 1);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12649 Lisp_Object last_parms = AREF (last_show_tip_args, 2);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12650
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12651 if (EQ (frame, last_frame)
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12652 && !NILP (Fequal (last_string, string))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12653 && !NILP (Fequal (last_parms, parms)))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12654 {
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12655 struct frame *f = XFRAME (tip_frame);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12656
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12657 /* Only DX and DY have changed. */
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12658 if (!NILP (tip_timer))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12659 {
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12660 Lisp_Object timer = tip_timer;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12661 tip_timer = Qnil;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12662 call1 (Qcancel_timer, timer);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12663 }
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12664
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12665 BLOCK_INPUT;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12666 compute_tip_xy (f, parms, dx, dy, &root_x, &root_y);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12667 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12668 root_x, root_y - PIXEL_HEIGHT (f));
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12669 UNBLOCK_INPUT;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12670 goto start_timer;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12671 }
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12672 }
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12673
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12674 /* Hide a previous tip, if any. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12675 Fx_hide_tip ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12676
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12677 ASET (last_show_tip_args, 0, string);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12678 ASET (last_show_tip_args, 1, frame);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12679 ASET (last_show_tip_args, 2, parms);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12680
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12681 /* Add default values to frame parameters. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12682 if (NILP (Fassq (Qname, parms)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12683 parms = Fcons (Fcons (Qname, build_string ("tooltip")), parms);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12684 if (NILP (Fassq (Qinternal_border_width, parms)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12685 parms = Fcons (Fcons (Qinternal_border_width, make_number (3)), parms);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12686 if (NILP (Fassq (Qborder_width, parms)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12687 parms = Fcons (Fcons (Qborder_width, make_number (1)), parms);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12688 if (NILP (Fassq (Qborder_color, parms)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12689 parms = Fcons (Fcons (Qborder_color, build_string ("lightyellow")), parms);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12690 if (NILP (Fassq (Qbackground_color, parms)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12691 parms = Fcons (Fcons (Qbackground_color, build_string ("lightyellow")),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12692 parms);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12693
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12694 /* Create a frame for the tooltip, and record it in the global
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12695 variable tip_frame. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12696 frame = x_create_tip_frame (FRAME_W32_DISPLAY_INFO (f), parms);
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12697 f = XFRAME (frame);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12698
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12699 /* Set up the frame's root window. Currently we use a size of 80
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12700 columns x 40 lines. If someone wants to show a larger tip, he
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12701 will loose. I don't think this is a realistic case. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12702 w = XWINDOW (FRAME_ROOT_WINDOW (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12703 w->left = w->top = make_number (0);
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12704 w->width = make_number (80);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12705 w->height = make_number (40);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12706 adjust_glyphs (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12707 w->pseudo_window_p = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12708
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12709 /* Display the tooltip text in a temporary buffer. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12710 buffer = Fget_buffer_create (build_string (" *tip*"));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12711 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12712 old_buffer = current_buffer;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12713 set_buffer_internal_1 (XBUFFER (buffer));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12714 Ferase_buffer ();
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12715 Finsert (1, &string);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12716 clear_glyph_matrix (w->desired_matrix);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12717 clear_glyph_matrix (w->current_matrix);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12718 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12719 try_window (FRAME_ROOT_WINDOW (f), pos);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12720
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12721 /* Compute width and height of the tooltip. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12722 width = height = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12723 for (i = 0; i < w->desired_matrix->nrows; ++i)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12724 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12725 struct glyph_row *row = &w->desired_matrix->rows[i];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12726 struct glyph *last;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12727 int row_width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12728
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12729 /* Stop at the first empty row at the end. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12730 if (!row->enabled_p || !row->displays_text_p)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12731 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12732
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12733 /* Let the row go over the full width of the frame. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12734 row->full_width_p = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12735
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12736 /* There's a glyph at the end of rows that is use to place
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12737 the cursor there. Don't include the width of this glyph. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12738 if (row->used[TEXT_AREA])
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12739 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12740 last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12741 row_width = row->pixel_width - last->pixel_width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12742 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12743 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12744 row_width = row->pixel_width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12745
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12746 height += row->height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12747 width = max (width, row_width);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12748 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12749
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12750 /* Add the frame's internal border to the width and height the X
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12751 window should have. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12752 height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12753 width += 2 * FRAME_INTERNAL_BORDER_WIDTH (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12754
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12755 /* Move the tooltip window where the mouse pointer is. Resize and
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12756 show it. */
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12757 compute_tip_xy (f, parms, dx, dy, &root_x, &root_y);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12758
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12759 #if 0 /* TODO : W32 specifics */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12760 BLOCK_INPUT;
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12761 XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12762 root_x, root_y - height, width, height);
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
12763 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12764 UNBLOCK_INPUT;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12765 #endif /* TODO */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12766
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12767 /* Draw into the window. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12768 w->must_be_updated_p = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12769 update_single_window (w, 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12770
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12771 /* Restore original current buffer. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12772 set_buffer_internal_1 (old_buffer);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12773 windows_or_buffers_changed = old_windows_or_buffers_changed;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12774
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12775 start_timer:
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12776 /* Let the tip disappear after timeout seconds. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12777 tip_timer = call3 (intern ("run-at-time"), timeout, Qnil,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12778 intern ("x-hide-tip"));
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
12779
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12780 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12781 return unbind_to (count, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12782 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12783
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12784
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12785 DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12786 "Hide the current tooltip window, if there is any.\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12787 Value is t is tooltip was open, nil otherwise.")
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12788 ()
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12789 {
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12790 int count;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12791 Lisp_Object deleted, frame, timer;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12792 struct gcpro gcpro1, gcpro2;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12793
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12794 /* Return quickly if nothing to do. */
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12795 if (NILP (tip_timer) && NILP (tip_frame))
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12796 return Qnil;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12797
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12798 frame = tip_frame;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12799 timer = tip_timer;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12800 GCPRO2 (frame, timer);
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12801 tip_frame = tip_timer = deleted = Qnil;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12802
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12803 count = BINDING_STACK_SIZE ();
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12804 specbind (Qinhibit_redisplay, Qt);
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12805 specbind (Qinhibit_quit, Qt);
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12806
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12807 if (!NILP (timer))
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
12808 call1 (Qcancel_timer, timer);
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12809
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12810 if (FRAMEP (frame))
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12811 {
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12812 Fdelete_frame (frame, Qnil);
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12813 deleted = Qt;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12814 }
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12815
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12816 UNGCPRO;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
12817 return unbind_to (count, deleted);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12818 }
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
12819 #endif
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12820
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12821
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12822
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12823 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12824 File selection dialog
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12825 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12826
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12827 extern Lisp_Object Qfile_name_history;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12828
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12829 DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12830 "Read file name, prompting with PROMPT in directory DIR.\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12831 Use a file selection dialog.\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12832 Select DEFAULT-FILENAME in the dialog's file selection box, if\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12833 specified. Don't let the user enter a file name in the file\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12834 selection dialog's entry field, if MUSTMATCH is non-nil.")
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12835 (prompt, dir, default_filename, mustmatch)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12836 Lisp_Object prompt, dir, default_filename, mustmatch;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12837 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12838 struct frame *f = SELECTED_FRAME ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12839 Lisp_Object file = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12840 int count = specpdl_ptr - specpdl;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12841 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12842 char filename[MAX_PATH + 1];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12843 char init_dir[MAX_PATH + 1];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12844 int use_dialog_p = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12845
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12846 GCPRO5 (prompt, dir, default_filename, mustmatch, file);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12847 CHECK_STRING (prompt, 0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12848 CHECK_STRING (dir, 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12849
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12850 /* Create the dialog with PROMPT as title, using DIR as initial
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12851 directory and using "*" as pattern. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12852 dir = Fexpand_file_name (dir, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12853 strncpy (init_dir, XSTRING (dir)->data, MAX_PATH);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12854 init_dir[MAX_PATH] = '\0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12855 unixtodos_filename (init_dir);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12856
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12857 if (STRINGP (default_filename))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12858 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12859 char *file_name_only;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12860 char *full_path_name = XSTRING (default_filename)->data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12861
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12862 unixtodos_filename (full_path_name);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12863
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12864 file_name_only = strrchr (full_path_name, '\\');
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12865 if (!file_name_only)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12866 file_name_only = full_path_name;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12867 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12868 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12869 file_name_only++;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12870
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12871 /* If default_file_name is a directory, don't use the open
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12872 file dialog, as it does not support selecting
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12873 directories. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12874 if (!(*file_name_only))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12875 use_dialog_p = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12876 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12877
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12878 strncpy (filename, file_name_only, MAX_PATH);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12879 filename[MAX_PATH] = '\0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12880 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12881 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12882 filename[0] = '\0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12883
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12884 if (use_dialog_p)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12885 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12886 OPENFILENAME file_details;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12887
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12888 /* Prevent redisplay. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12889 specbind (Qinhibit_redisplay, Qt);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12890 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12891
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12892 bzero (&file_details, sizeof (file_details));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12893 file_details.lStructSize = sizeof (file_details);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12894 file_details.hwndOwner = FRAME_W32_WINDOW (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12895 file_details.lpstrFile = filename;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12896 file_details.nMaxFile = sizeof (filename);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12897 file_details.lpstrInitialDir = init_dir;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12898 file_details.lpstrTitle = XSTRING (prompt)->data;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12899 file_details.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12900
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12901 if (!NILP (mustmatch))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12902 file_details.Flags |= OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12903
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12904 if (GetOpenFileName (&file_details))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12905 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12906 dostounix_filename (filename);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12907 file = build_string (filename);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12908 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12909 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12910 file = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12911
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12912 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12913 file = unbind_to (count, file);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12914 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12915 /* Open File dialog will not allow folders to be selected, so resort
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12916 to minibuffer completing reads for directories. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12917 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12918 file = Fcompleting_read (prompt, intern ("read-file-name-internal"),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12919 dir, mustmatch, dir, Qfile_name_history,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12920 default_filename, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12921
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12922 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12923
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12924 /* Make "Cancel" equivalent to C-g. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12925 if (NILP (file))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12926 Fsignal (Qquit, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12927
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
12928 return unbind_to (count, file);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12929 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12930
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12931
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12932
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12933 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12934 Tests
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12935 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12936
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12937 #if GLYPH_DEBUG
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12938
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12939 DEFUN ("imagep", Fimagep, Simagep, 1, 1, 0,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12940 "Value is non-nil if SPEC is a valid image specification.")
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12941 (spec)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12942 Lisp_Object spec;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12943 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12944 return valid_image_p (spec) ? Qt : Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12945 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12946
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12947
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12948 DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "")
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12949 (spec)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12950 Lisp_Object spec;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12951 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12952 int id = -1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12953
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12954 if (valid_image_p (spec))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12955 id = lookup_image (SELECTED_FRAME (), spec);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12956
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12957 debug_print (spec);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12958 return make_number (id);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12959 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12960
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12961 #endif /* GLYPH_DEBUG != 0 */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12962
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12963
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12964
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12965 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12966 w32 specialized functions
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12967 ***********************************************************************/
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
12968
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
12969 DEFUN ("w32-select-font", Fw32_select_font, Sw32_select_font, 0, 1, 0,
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
12970 "This will display the W32 font dialog and return an X font string corresponding to the selection.")
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12971 (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12972 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12973 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12974 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12975 CHOOSEFONT cf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12976 LOGFONT lf;
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
12977 TEXTMETRIC tm;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
12978 HDC hdc;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
12979 HANDLE oldobj;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12980 char buf[100];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12981
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12982 bzero (&cf, sizeof (cf));
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
12983 bzero (&lf, sizeof (lf));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12984
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12985 cf.lStructSize = sizeof (cf);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
12986 cf.hwndOwner = FRAME_W32_WINDOW (f);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
12987 cf.Flags = CF_FORCEFONTEXIST | CF_SCREENFONTS;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12988 cf.lpLogFont = &lf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12989
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
12990 /* Initialize as much of the font details as we can from the current
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
12991 default font. */
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
12992 hdc = GetDC (FRAME_W32_WINDOW (f));
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
12993 oldobj = SelectObject (hdc, FRAME_FONT (f)->hfont);
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
12994 GetTextFace (hdc, LF_FACESIZE, lf.lfFaceName);
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
12995 if (GetTextMetrics (hdc, &tm))
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
12996 {
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
12997 lf.lfHeight = tm.tmInternalLeading - tm.tmHeight;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
12998 lf.lfWeight = tm.tmWeight;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
12999 lf.lfItalic = tm.tmItalic;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
13000 lf.lfUnderline = tm.tmUnderlined;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
13001 lf.lfStrikeOut = tm.tmStruckOut;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
13002 lf.lfCharSet = tm.tmCharSet;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
13003 cf.Flags |= CF_INITTOLOGFONTSTRUCT;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
13004 }
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
13005 SelectObject (hdc, oldobj);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13006 ReleaseDC (FRAME_W32_WINDOW (f), hdc);
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
13007
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13008 if (!ChooseFont (&cf) || !w32_to_x_font (&lf, buf, 100, NULL))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
13009 return Qnil;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13010
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13011 return build_string (buf);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13012 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13013
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13014 DEFUN ("w32-send-sys-command", Fw32_send_sys_command, Sw32_send_sys_command, 1, 2, 0,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13015 "Send frame a Windows WM_SYSCOMMAND message of type COMMAND.\n\
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13016 Some useful values for command are 0xf030 to maximise frame (0xf020\n\
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13017 to minimize), 0xf120 to restore frame to original size, and 0xf100\n\
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13018 to activate the menubar for keyboard access. 0xf140 activates the\n\
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13019 screen saver if defined.\n\
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13020 \n\
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13021 If optional parameter FRAME is not specified, use selected frame.")
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13022 (command, frame)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13023 Lisp_Object command, frame;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13024 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13025 FRAME_PTR f = check_x_frame (frame);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13026
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13027 CHECK_NUMBER (command, 0);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13028
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
13029 PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, XINT (command), 0);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13030
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13031 return Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13032 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13033
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13034 DEFUN ("w32-shell-execute", Fw32_shell_execute, Sw32_shell_execute, 2, 4, 0,
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13035 "Get Windows to perform OPERATION on DOCUMENT.\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13036 This is a wrapper around the ShellExecute system function, which\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13037 invokes the application registered to handle OPERATION for DOCUMENT.\n\
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13038 OPERATION is typically \"open\", \"print\" or \"explore\" (but can be\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13039 nil for the default action), and DOCUMENT is typically the name of a\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13040 document file or URL, but can also be a program executable to run or\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13041 a directory to open in the Windows Explorer.\n\
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13042 \n\
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13043 If DOCUMENT is a program executable, PARAMETERS can be a string\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13044 containing command line parameters, but otherwise should be nil.\n\
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13045 \n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13046 SHOW-FLAG can be used to control whether the invoked application is hidden\n\
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13047 or minimized. If SHOW-FLAG is nil, the application is displayed normally,\n\
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13048 otherwise it is an integer representing a ShowWindow flag:\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13049 \n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13050 0 - start hidden\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13051 1 - start normally\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13052 3 - start maximized\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13053 6 - start minimized")
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13054 (operation, document, parameters, show_flag)
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13055 Lisp_Object operation, document, parameters, show_flag;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13056 {
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13057 Lisp_Object current_dir;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13058
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13059 CHECK_STRING (document, 0);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13060
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13061 /* Encode filename and current directory. */
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13062 current_dir = ENCODE_FILE (current_buffer->directory);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13063 document = ENCODE_FILE (document);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13064 if ((int) ShellExecute (NULL,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13065 (STRINGP (operation) ?
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13066 XSTRING (operation)->data : NULL),
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13067 XSTRING (document)->data,
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13068 (STRINGP (parameters) ?
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13069 XSTRING (parameters)->data : NULL),
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13070 XSTRING (current_dir)->data,
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13071 (INTEGERP (show_flag) ?
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13072 XINT (show_flag) : SW_SHOWDEFAULT))
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13073 > 32)
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13074 return Qt;
34698
cc62e2e0949d (Fw32_shell_execute): Use it.
Andrew Innes <andrewi@gnu.org>
parents: 34643
diff changeset
13075 error ("ShellExecute failed: %s", w32_strerror (0));
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13076 }
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13077
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13078 /* Lookup virtual keycode from string representing the name of a
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13079 non-ascii keystroke into the corresponding virtual key, using
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13080 lispy_function_keys. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13081 static int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13082 lookup_vk_code (char *key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13083 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13084 int i;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13085
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13086 for (i = 0; i < 256; i++)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13087 if (lispy_function_keys[i] != 0
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13088 && strcmp (lispy_function_keys[i], key) == 0)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13089 return i;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13090
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13091 return -1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13092 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13093
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13094 /* Convert a one-element vector style key sequence to a hot key
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13095 definition. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13096 static int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13097 w32_parse_hot_key (key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13098 Lisp_Object key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13099 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13100 /* Copied from Fdefine_key and store_in_keymap. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13101 register Lisp_Object c;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13102 int vk_code;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13103 int lisp_modifiers;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13104 int w32_modifiers;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13105 struct gcpro gcpro1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13106
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13107 CHECK_VECTOR (key, 0);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13108
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13109 if (XFASTINT (Flength (key)) != 1)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13110 return Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13111
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13112 GCPRO1 (key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13113
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13114 c = Faref (key, make_number (0));
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13115
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13116 if (CONSP (c) && lucid_event_type_list_p (c))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13117 c = Fevent_convert_list (c);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13118
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13119 UNGCPRO;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13120
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13121 if (! INTEGERP (c) && ! SYMBOLP (c))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13122 error ("Key definition is invalid");
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13123
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13124 /* Work out the base key and the modifiers. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13125 if (SYMBOLP (c))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13126 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13127 c = parse_modifiers (c);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13128 lisp_modifiers = Fcar (Fcdr (c));
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13129 c = Fcar (c);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13130 if (!SYMBOLP (c))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13131 abort ();
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13132 vk_code = lookup_vk_code (XSYMBOL (c)->name->data);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13133 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13134 else if (INTEGERP (c))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13135 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13136 lisp_modifiers = XINT (c) & ~CHARACTERBITS;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13137 /* Many ascii characters are their own virtual key code. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13138 vk_code = XINT (c) & CHARACTERBITS;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13139 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13140
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13141 if (vk_code < 0 || vk_code > 255)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13142 return Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13143
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13144 if ((lisp_modifiers & meta_modifier) != 0
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13145 && !NILP (Vw32_alt_is_meta))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13146 lisp_modifiers |= alt_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13147
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
13148 /* Supply defs missing from mingw32. */
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
13149 #ifndef MOD_ALT
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
13150 #define MOD_ALT 0x0001
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
13151 #define MOD_CONTROL 0x0002
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
13152 #define MOD_SHIFT 0x0004
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
13153 #define MOD_WIN 0x0008
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
13154 #endif
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
13155
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13156 /* Convert lisp modifiers to Windows hot-key form. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13157 w32_modifiers = (lisp_modifiers & hyper_modifier) ? MOD_WIN : 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13158 w32_modifiers |= (lisp_modifiers & alt_modifier) ? MOD_ALT : 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13159 w32_modifiers |= (lisp_modifiers & ctrl_modifier) ? MOD_CONTROL : 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13160 w32_modifiers |= (lisp_modifiers & shift_modifier) ? MOD_SHIFT : 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13161
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13162 return HOTKEY (vk_code, w32_modifiers);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13163 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13164
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13165 DEFUN ("w32-register-hot-key", Fw32_register_hot_key, Sw32_register_hot_key, 1, 1, 0,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13166 "Register KEY as a hot-key combination.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13167 Certain key combinations like Alt-Tab are reserved for system use on\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13168 Windows, and therefore are normally intercepted by the system. However,\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13169 most of these key combinations can be received by registering them as\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13170 hot-keys, overriding their special meaning.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13171 \n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13172 KEY must be a one element key definition in vector form that would be\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13173 acceptable to `define-key' (e.g. [A-tab] for Alt-Tab). The meta\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13174 modifier is interpreted as Alt if `w32-alt-is-meta' is t, and hyper\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13175 is always interpreted as the Windows modifier keys.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13176 \n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13177 The return value is the hotkey-id if registered, otherwise nil.")
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13178 (key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13179 Lisp_Object key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13180 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13181 key = w32_parse_hot_key (key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13182
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13183 if (NILP (Fmemq (key, w32_grabbed_keys)))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13184 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13185 /* Reuse an empty slot if possible. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13186 Lisp_Object item = Fmemq (Qnil, w32_grabbed_keys);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13187
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13188 /* Safe to add new key to list, even if we have focus. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13189 if (NILP (item))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13190 w32_grabbed_keys = Fcons (key, w32_grabbed_keys);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13191 else
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13192 XCAR (item) = key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13193
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13194 /* Notify input thread about new hot-key definition, so that it
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13195 takes effect without needing to switch focus. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13196 PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13197 (WPARAM) key, 0);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13198 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13199
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13200 return key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13201 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13202
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13203 DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key, Sw32_unregister_hot_key, 1, 1, 0,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13204 "Unregister HOTKEY as a hot-key combination.")
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13205 (key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13206 Lisp_Object key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13207 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13208 Lisp_Object item;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13209
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13210 if (!INTEGERP (key))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13211 key = w32_parse_hot_key (key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13212
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13213 item = Fmemq (key, w32_grabbed_keys);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13214
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13215 if (!NILP (item))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13216 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13217 /* Notify input thread about hot-key definition being removed, so
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13218 that it takes effect without needing focus switch. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13219 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13220 (WPARAM) XINT (XCAR (item)), (LPARAM) item))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13221 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13222 MSG msg;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13223 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13224 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13225 return Qt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13226 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13227 return Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13228 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13229
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13230 DEFUN ("w32-registered-hot-keys", Fw32_registered_hot_keys, Sw32_registered_hot_keys, 0, 0, 0,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13231 "Return list of registered hot-key IDs.")
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13232 ()
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13233 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13234 return Fcopy_sequence (w32_grabbed_keys);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13235 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13236
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13237 DEFUN ("w32-reconstruct-hot-key", Fw32_reconstruct_hot_key, Sw32_reconstruct_hot_key, 1, 1, 0,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13238 "Convert hot-key ID to a lisp key combination.")
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13239 (hotkeyid)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13240 Lisp_Object hotkeyid;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13241 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13242 int vk_code, w32_modifiers;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13243 Lisp_Object key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13244
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13245 CHECK_NUMBER (hotkeyid, 0);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13246
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13247 vk_code = HOTKEY_VK_CODE (hotkeyid);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13248 w32_modifiers = HOTKEY_MODIFIERS (hotkeyid);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13249
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13250 if (lispy_function_keys[vk_code])
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13251 key = intern (lispy_function_keys[vk_code]);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13252 else
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13253 key = make_number (vk_code);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13254
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13255 key = Fcons (key, Qnil);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13256 if (w32_modifiers & MOD_SHIFT)
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
13257 key = Fcons (Qshift, key);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13258 if (w32_modifiers & MOD_CONTROL)
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
13259 key = Fcons (Qctrl, key);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13260 if (w32_modifiers & MOD_ALT)
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
13261 key = Fcons (NILP (Vw32_alt_is_meta) ? Qalt : Qmeta, key);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13262 if (w32_modifiers & MOD_WIN)
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
13263 key = Fcons (Qhyper, key);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13264
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13265 return key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13266 }
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13267
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13268 DEFUN ("w32-toggle-lock-key", Fw32_toggle_lock_key, Sw32_toggle_lock_key, 1, 2, 0,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13269 "Toggle the state of the lock key KEY.\n\
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13270 KEY can be `capslock', `kp-numlock', or `scroll'.\n\
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13271 If the optional parameter NEW-STATE is a number, then the state of KEY\n\
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13272 is set to off if the low bit of NEW-STATE is zero, otherwise on.")
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13273 (key, new_state)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13274 Lisp_Object key, new_state;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13275 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13276 int vk_code;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13277
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13278 if (EQ (key, intern ("capslock")))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13279 vk_code = VK_CAPITAL;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13280 else if (EQ (key, intern ("kp-numlock")))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13281 vk_code = VK_NUMLOCK;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13282 else if (EQ (key, intern ("scroll")))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13283 vk_code = VK_SCROLL;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13284 else
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13285 return Qnil;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13286
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13287 if (!dwWindowsThreadId)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13288 return make_number (w32_console_toggle_lock_key (vk_code, new_state));
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13289
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13290 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13291 (WPARAM) vk_code, (LPARAM) new_state))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13292 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13293 MSG msg;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13294 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13295 return make_number (msg.wParam);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13296 }
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13297 return Qnil;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13298 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13299
34643
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13300 DEFUN ("file-system-info", Ffile_system_info, Sfile_system_info, 1, 1, 0,
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13301 "Return storage information about the file system FILENAME is on.\n\
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13302 Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total\n\
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13303 storage of the file system, FREE is the free storage, and AVAIL is the\n\
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13304 storage available to a non-superuser. All 3 numbers are in bytes.\n\
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13305 If the underlying system call fails, value is nil.")
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13306 (filename)
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13307 Lisp_Object filename;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13308 {
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13309 Lisp_Object encoded, value;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13310
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13311 CHECK_STRING (filename, 0);
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13312 filename = Fexpand_file_name (filename, Qnil);
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13313 encoded = ENCODE_FILE (filename);
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13314
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13315 value = Qnil;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13316
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13317 /* Determining the required information on Windows turns out, sadly,
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13318 to be more involved than one would hope. The original Win32 api
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13319 call for this will return bogus information on some systems, but we
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13320 must dynamically probe for the replacement api, since that was
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13321 added rather late on. */
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13322 {
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13323 HMODULE hKernel = GetModuleHandle ("kernel32");
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13324 BOOL (*pfn_GetDiskFreeSpaceEx)
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13325 (char *, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER)
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13326 = (void *) GetProcAddress (hKernel, "GetDiskFreeSpaceEx");
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13327
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13328 /* On Windows, we may need to specify the root directory of the
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13329 volume holding FILENAME. */
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13330 char rootname[MAX_PATH];
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13331 char *name = XSTRING (encoded)->data;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13332
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13333 /* find the root name of the volume if given */
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13334 if (isalpha (name[0]) && name[1] == ':')
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13335 {
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13336 rootname[0] = name[0];
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13337 rootname[1] = name[1];
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13338 rootname[2] = '\\';
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13339 rootname[3] = 0;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13340 }
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13341 else if (IS_DIRECTORY_SEP (name[0]) && IS_DIRECTORY_SEP (name[1]))
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13342 {
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13343 char *str = rootname;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13344 int slashes = 4;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13345 do
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13346 {
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13347 if (IS_DIRECTORY_SEP (*name) && --slashes == 0)
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13348 break;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13349 *str++ = *name++;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13350 }
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13351 while ( *name );
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13352
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13353 *str++ = '\\';
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13354 *str = 0;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13355 }
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13356
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13357 if (pfn_GetDiskFreeSpaceEx)
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13358 {
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13359 LARGE_INTEGER availbytes;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13360 LARGE_INTEGER freebytes;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13361 LARGE_INTEGER totalbytes;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13362
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13363 if (pfn_GetDiskFreeSpaceEx(rootname,
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13364 &availbytes,
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13365 &totalbytes,
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13366 &freebytes))
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13367 value = list3 (make_float ((double) totalbytes.QuadPart),
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13368 make_float ((double) freebytes.QuadPart),
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13369 make_float ((double) availbytes.QuadPart));
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13370 }
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13371 else
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13372 {
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13373 DWORD sectors_per_cluster;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13374 DWORD bytes_per_sector;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13375 DWORD free_clusters;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13376 DWORD total_clusters;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13377
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13378 if (GetDiskFreeSpace(rootname,
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13379 &sectors_per_cluster,
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13380 &bytes_per_sector,
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13381 &free_clusters,
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13382 &total_clusters))
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13383 value = list3 (make_float ((double) total_clusters
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13384 * sectors_per_cluster * bytes_per_sector),
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13385 make_float ((double) free_clusters
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13386 * sectors_per_cluster * bytes_per_sector),
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13387 make_float ((double) free_clusters
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13388 * sectors_per_cluster * bytes_per_sector));
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13389 }
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13390 }
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13391
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13392 return value;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13393 }
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13394
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13395 syms_of_w32fns ()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13396 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13397 /* This is zero if not using MS-Windows. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13398 w32_in_use = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13399
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13400 /* The section below is built by the lisp expression at the top of the file,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13401 just above where these variables are declared. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13402 /*&&& init symbols here &&&*/
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13403 Qauto_raise = intern ("auto-raise");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13404 staticpro (&Qauto_raise);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13405 Qauto_lower = intern ("auto-lower");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13406 staticpro (&Qauto_lower);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13407 Qbar = intern ("bar");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13408 staticpro (&Qbar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13409 Qborder_color = intern ("border-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13410 staticpro (&Qborder_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13411 Qborder_width = intern ("border-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13412 staticpro (&Qborder_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13413 Qbox = intern ("box");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13414 staticpro (&Qbox);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13415 Qcursor_color = intern ("cursor-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13416 staticpro (&Qcursor_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13417 Qcursor_type = intern ("cursor-type");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13418 staticpro (&Qcursor_type);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13419 Qgeometry = intern ("geometry");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13420 staticpro (&Qgeometry);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13421 Qicon_left = intern ("icon-left");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13422 staticpro (&Qicon_left);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13423 Qicon_top = intern ("icon-top");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13424 staticpro (&Qicon_top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13425 Qicon_type = intern ("icon-type");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13426 staticpro (&Qicon_type);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13427 Qicon_name = intern ("icon-name");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13428 staticpro (&Qicon_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13429 Qinternal_border_width = intern ("internal-border-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13430 staticpro (&Qinternal_border_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13431 Qleft = intern ("left");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13432 staticpro (&Qleft);
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
13433 Qright = intern ("right");
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
13434 staticpro (&Qright);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13435 Qmouse_color = intern ("mouse-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13436 staticpro (&Qmouse_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13437 Qnone = intern ("none");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13438 staticpro (&Qnone);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13439 Qparent_id = intern ("parent-id");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13440 staticpro (&Qparent_id);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13441 Qscroll_bar_width = intern ("scroll-bar-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13442 staticpro (&Qscroll_bar_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13443 Qsuppress_icon = intern ("suppress-icon");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13444 staticpro (&Qsuppress_icon);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13445 Qundefined_color = intern ("undefined-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13446 staticpro (&Qundefined_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13447 Qvertical_scroll_bars = intern ("vertical-scroll-bars");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13448 staticpro (&Qvertical_scroll_bars);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13449 Qvisibility = intern ("visibility");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13450 staticpro (&Qvisibility);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13451 Qwindow_id = intern ("window-id");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13452 staticpro (&Qwindow_id);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13453 Qx_frame_parameter = intern ("x-frame-parameter");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13454 staticpro (&Qx_frame_parameter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13455 Qx_resource_name = intern ("x-resource-name");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13456 staticpro (&Qx_resource_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13457 Quser_position = intern ("user-position");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13458 staticpro (&Quser_position);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13459 Quser_size = intern ("user-size");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13460 staticpro (&Quser_size);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13461 Qscreen_gamma = intern ("screen-gamma");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13462 staticpro (&Qscreen_gamma);
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13463 Qline_spacing = intern ("line-spacing");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13464 staticpro (&Qline_spacing);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13465 Qcenter = intern ("center");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13466 staticpro (&Qcenter);
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
13467 Qcancel_timer = intern ("cancel-timer");
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
13468 staticpro (&Qcancel_timer);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13469 /* This is the end of symbol initialization. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13470
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13471 Qhyper = intern ("hyper");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13472 staticpro (&Qhyper);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13473 Qsuper = intern ("super");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13474 staticpro (&Qsuper);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13475 Qmeta = intern ("meta");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13476 staticpro (&Qmeta);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13477 Qalt = intern ("alt");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13478 staticpro (&Qalt);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13479 Qctrl = intern ("ctrl");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13480 staticpro (&Qctrl);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13481 Qcontrol = intern ("control");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13482 staticpro (&Qcontrol);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13483 Qshift = intern ("shift");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13484 staticpro (&Qshift);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13485
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13486 /* Text property `display' should be nonsticky by default. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13487 Vtext_property_default_nonsticky
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13488 = Fcons (Fcons (Qdisplay, Qt), Vtext_property_default_nonsticky);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13489
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13490
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13491 Qlaplace = intern ("laplace");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13492 staticpro (&Qlaplace);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13493
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
13494 Qface_set_after_frame_default = intern ("face-set-after-frame-default");
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
13495 staticpro (&Qface_set_after_frame_default);
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
13496
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13497 Fput (Qundefined_color, Qerror_conditions,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13498 Fcons (Qundefined_color, Fcons (Qerror, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13499 Fput (Qundefined_color, Qerror_message,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13500 build_string ("Undefined color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13501
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13502 staticpro (&w32_grabbed_keys);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13503 w32_grabbed_keys = Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13504
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13505 DEFVAR_LISP ("w32-color-map", &Vw32_color_map,
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13506 "An array of color name mappings for windows.");
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13507 Vw32_color_map = Qnil;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13508
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13509 DEFVAR_LISP ("w32-pass-alt-to-system", &Vw32_pass_alt_to_system,
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
13510 "Non-nil if alt key presses are passed on to Windows.\n\
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
13511 When non-nil, for example, alt pressed and released and then space will\n\
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
13512 open the System menu. When nil, Emacs silently swallows alt key events.");
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13513 Vw32_pass_alt_to_system = Qnil;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13514
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13515 DEFVAR_LISP ("w32-alt-is-meta", &Vw32_alt_is_meta,
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
13516 "Non-nil if the alt key is to be considered the same as the meta key.\n\
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
13517 When nil, Emacs will translate the alt key to the Alt modifier, and not Meta.");
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13518 Vw32_alt_is_meta = Qt;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13519
24339
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
13520 DEFVAR_INT ("w32-quit-key", &Vw32_quit_key,
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
13521 "If non-zero, the virtual key code for an alternative quit key.");
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
13522 XSETINT (Vw32_quit_key, 0);
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
13523
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13524 DEFVAR_LISP ("w32-pass-lwindow-to-system",
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13525 &Vw32_pass_lwindow_to_system,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13526 "Non-nil if the left \"Windows\" key is passed on to Windows.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13527 When non-nil, the Start menu is opened by tapping the key.");
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13528 Vw32_pass_lwindow_to_system = Qt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13529
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13530 DEFVAR_LISP ("w32-pass-rwindow-to-system",
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13531 &Vw32_pass_rwindow_to_system,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13532 "Non-nil if the right \"Windows\" key is passed on to Windows.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13533 When non-nil, the Start menu is opened by tapping the key.");
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13534 Vw32_pass_rwindow_to_system = Qt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13535
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13536 DEFVAR_INT ("w32-phantom-key-code",
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13537 &Vw32_phantom_key_code,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13538 "Virtual key code used to generate \"phantom\" key presses.\n\
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13539 Value is a number between 0 and 255.\n\
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13540 \n\
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13541 Phantom key presses are generated in order to stop the system from\n\
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13542 acting on \"Windows\" key events when `w32-pass-lwindow-to-system' or\n\
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13543 `w32-pass-rwindow-to-system' is nil.");
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
13544 /* Although 255 is technically not a valid key code, it works and
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
13545 means that this hack won't interfere with any real key code. */
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
13546 Vw32_phantom_key_code = 255;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13547
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13548 DEFVAR_LISP ("w32-enable-num-lock",
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13549 &Vw32_enable_num_lock,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13550 "Non-nil if Num Lock should act normally.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13551 Set to nil to see Num Lock as the key `kp-numlock'.");
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13552 Vw32_enable_num_lock = Qt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13553
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13554 DEFVAR_LISP ("w32-enable-caps-lock",
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13555 &Vw32_enable_caps_lock,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13556 "Non-nil if Caps Lock should act normally.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13557 Set to nil to see Caps Lock as the key `capslock'.");
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13558 Vw32_enable_caps_lock = Qt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13559
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13560 DEFVAR_LISP ("w32-scroll-lock-modifier",
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13561 &Vw32_scroll_lock_modifier,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13562 "Modifier to use for the Scroll Lock on state.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13563 The value can be hyper, super, meta, alt, control or shift for the\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13564 respective modifier, or nil to see Scroll Lock as the key `scroll'.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13565 Any other value will cause the key to be ignored.");
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13566 Vw32_scroll_lock_modifier = Qt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13567
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13568 DEFVAR_LISP ("w32-lwindow-modifier",
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13569 &Vw32_lwindow_modifier,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13570 "Modifier to use for the left \"Windows\" key.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13571 The value can be hyper, super, meta, alt, control or shift for the\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13572 respective modifier, or nil to appear as the key `lwindow'.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13573 Any other value will cause the key to be ignored.");
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13574 Vw32_lwindow_modifier = Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13575
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13576 DEFVAR_LISP ("w32-rwindow-modifier",
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13577 &Vw32_rwindow_modifier,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13578 "Modifier to use for the right \"Windows\" key.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13579 The value can be hyper, super, meta, alt, control or shift for the\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13580 respective modifier, or nil to appear as the key `rwindow'.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13581 Any other value will cause the key to be ignored.");
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13582 Vw32_rwindow_modifier = Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13583
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13584 DEFVAR_LISP ("w32-apps-modifier",
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13585 &Vw32_apps_modifier,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13586 "Modifier to use for the \"Apps\" key.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13587 The value can be hyper, super, meta, alt, control or shift for the\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13588 respective modifier, or nil to appear as the key `apps'.\n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13589 Any other value will cause the key to be ignored.");
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13590 Vw32_apps_modifier = Qnil;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13591
30239
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
13592 DEFVAR_LISP ("w32-enable-synthesized-fonts", &Vw32_enable_synthesized_fonts,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13593 "Non-nil enables selection of artificially italicized and bold fonts.");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13594 Vw32_enable_synthesized_fonts = Qnil;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13595
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13596 DEFVAR_LISP ("w32-enable-palette", &Vw32_enable_palette,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13597 "Non-nil enables Windows palette management to map colors exactly.");
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13598 Vw32_enable_palette = Qt;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13599
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13600 DEFVAR_INT ("w32-mouse-button-tolerance",
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13601 &Vw32_mouse_button_tolerance,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13602 "Analogue of double click interval for faking middle mouse events.\n\
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
13603 The value is the minimum time in milliseconds that must elapse between\n\
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
13604 left/right button down events before they are considered distinct events.\n\
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
13605 If both mouse buttons are depressed within this interval, a middle mouse\n\
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
13606 button down event is generated instead.");
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13607 XSETINT (Vw32_mouse_button_tolerance, GetDoubleClickTime () / 2);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13608
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13609 DEFVAR_INT ("w32-mouse-move-interval",
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13610 &Vw32_mouse_move_interval,
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
13611 "Minimum interval between mouse move events.\n\
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
13612 The value is the minimum time in milliseconds that must elapse between\n\
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
13613 successive mouse move (or scroll bar drag) events before they are\n\
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
13614 reported as lisp events.");
24252
e0ae6525db58 (syms_of_w32fns): Change default value of w32-mouse-move-interval to
Andrew Innes <andrewi@gnu.org>
parents: 24214
diff changeset
13615 XSETINT (Vw32_mouse_move_interval, 0);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
13616
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13617 init_x_parm_symbols ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13618
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13619 DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13620 "List of directories to search for bitmap files for w32.");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13621 Vx_bitmap_file_path = decode_env_path ((char *) 0, "PATH");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13622
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13623 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13624 "The shape of the pointer when over text.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13625 Changing the value does not affect existing frames\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13626 unless you set the mouse color.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13627 Vx_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13628
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13629 DEFVAR_LISP ("x-resource-name", &Vx_resource_name,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13630 "The name Emacs uses to look up resources; for internal use only.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13631 `x-get-resource' uses this as the first component of the instance name\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13632 when requesting resource values.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13633 Emacs initially sets `x-resource-name' to the name under which Emacs\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13634 was invoked, or to the value specified with the `-name' or `-rn'\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13635 switches, if present.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13636 Vx_resource_name = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13637
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13638 Vx_nontext_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13639
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13640 Vx_mode_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13641
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
13642 DEFVAR_LISP ("x-hourglass-pointer-shape", &Vx_hourglass_pointer_shape,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13643 "The shape of the pointer when Emacs is busy.\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13644 This variable takes effect when you create a new frame\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13645 or when you set the mouse color.");
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
13646 Vx_hourglass_pointer_shape = Qnil;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
13647
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
13648 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p,
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
13649 "Non-zero means Emacs displays an hourglass pointer on window systems.");
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
13650 display_hourglass_p = 1;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
13651
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
13652 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay,
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
13653 "*Seconds to wait before displaying an hourglass pointer.\n\
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13654 Value must be an integer or float.");
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
13655 Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY);
27936
4c1ad68f8688 Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents: 27894
diff changeset
13656
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13657 DEFVAR_LISP ("x-sensitive-text-pointer-shape",
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13658 &Vx_sensitive_text_pointer_shape,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13659 "The shape of the pointer when over mouse-sensitive text.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13660 This variable takes effect when you create a new frame\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13661 or when you set the mouse color.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13662 Vx_sensitive_text_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13663
34133
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
13664 DEFVAR_LISP ("x-window-horizontal-drag-cursor",
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
13665 &Vx_window_horizontal_drag_shape,
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
13666 "Pointer shape to use for indicating a window can be dragged horizontally.\n\
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
13667 This variable takes effect when you create a new frame\n\
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
13668 or when you set the mouse color.");
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
13669 Vx_window_horizontal_drag_shape = Qnil;
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
13670
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13671 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13672 "A string indicating the foreground color of the cursor box.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13673 Vx_cursor_fore_pixel = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13674
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13675 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13676 "Non-nil if no window manager is in use.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13677 Emacs doesn't try to figure this out; this is always nil\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13678 unless you set it to something else.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13679 /* We don't have any way to find this out, so set it to nil
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13680 and maybe the user would like to set it to t. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13681 Vx_no_window_manager = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13682
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13683 DEFVAR_LISP ("x-pixel-size-width-font-regexp",
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13684 &Vx_pixel_size_width_font_regexp,
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13685 "Regexp matching a font name whose width is the same as `PIXEL_SIZE'.\n\
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13686 \n\
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13687 Since Emacs gets width of a font matching with this regexp from\n\
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13688 PIXEL_SIZE field of the name, font finding mechanism gets faster for\n\
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13689 such a font. This is especially effective for such large fonts as\n\
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13690 Chinese, Japanese, and Korean.");
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13691 Vx_pixel_size_width_font_regexp = Qnil;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13692
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13693 DEFVAR_LISP ("image-cache-eviction-delay", &Vimage_cache_eviction_delay,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13694 "Time after which cached images are removed from the cache.\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13695 When an image has not been displayed this many seconds, remove it\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13696 from the image cache. Value must be an integer or nil with nil\n\
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13697 meaning don't clear the cache.");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13698 Vimage_cache_eviction_delay = make_number (30 * 60);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13699
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
13700 DEFVAR_LISP ("w32-bdf-filename-alist",
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
13701 &Vw32_bdf_filename_alist,
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
13702 "List of bdf fonts and their corresponding filenames.");
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
13703 Vw32_bdf_filename_alist = Qnil;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
13704
24481
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
13705 DEFVAR_BOOL ("w32-strict-fontnames",
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
13706 &w32_strict_fontnames,
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
13707 "Non-nil means only use fonts that are exact matches for those requested.\n\
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
13708 Default is nil, which allows old fontnames that are not XLFD compliant,\n\
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
13709 and allows third-party CJK display to work by specifying false charset\n\
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
13710 fields to trick Emacs into translating to Big5, SJIS etc.\n\
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
13711 Setting this to t will prevent wrong fonts being selected when\n\
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
13712 fontsets are automatically created.");
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
13713 w32_strict_fontnames = 0;
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
13714
24695
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
13715 DEFVAR_BOOL ("w32-strict-painting",
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
13716 &w32_strict_painting,
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
13717 "Non-nil means use strict rules for repainting frames.\n\
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
13718 Set this to nil to get the old behaviour for repainting; this should\n\
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
13719 only be necessary if the default setting causes problems.");
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
13720 w32_strict_painting = 1;
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
13721
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
13722 DEFVAR_LISP ("w32-system-coding-system",
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
13723 &Vw32_system_coding_system,
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
13724 "Coding system used by Windows system functions, such as for font names.");
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
13725 Vw32_system_coding_system = Qnil;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
13726
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13727 DEFVAR_LISP ("w32-charset-info-alist",
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13728 &Vw32_charset_info_alist,
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13729 "Alist linking Emacs character sets to Windows fonts\n\
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13730 and codepages. Each entry should be of the form:\n\
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13731 \n\
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13732 (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE))\n\
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13733 \n\
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13734 where CHARSET_NAME is a string used in font names to identify the charset,\n\
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13735 WINDOWS_CHARSET is a symbol that can be one of:\n\
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13736 w32-charset-ansi, w32-charset-default, w32-charset-symbol,\n\
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13737 w32-charset-shiftjis, w32-charset-hangeul, w32-charset-gb2312,\n\
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13738 w32-charset-chinesebig5, "
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13739 #ifdef JOHAB_CHARSET
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13740 "w32-charset-johab, w32-charset-hebrew,\n\
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13741 w32-charset-arabic, w32-charset-greek, w32-charset-turkish,\n\
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13742 w32-charset-vietnamese, w32-charset-thai, w32-charset-easteurope,\n\
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13743 w32-charset-russian, w32-charset-mac, w32-charset-baltic,\n"
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13744 #endif
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13745 #ifdef UNICODE_CHARSET
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13746 "w32-charset-unicode, "
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13747 #endif
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13748 "or w32-charset-oem.\n\
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13749 CODEPAGE should be an integer specifying the codepage that should be used\n\
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13750 to display the character set, t to do no translation and output as Unicode,\n\
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13751 or nil to do no translation and output as 8 bit (or multibyte on far-east\n\
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13752 versions of Windows) characters.");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13753 Vw32_charset_info_alist = Qnil;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13754
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13755 staticpro (&Qw32_charset_ansi);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13756 Qw32_charset_ansi = intern ("w32-charset-ansi");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13757 staticpro (&Qw32_charset_symbol);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13758 Qw32_charset_symbol = intern ("w32-charset-symbol");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13759 staticpro (&Qw32_charset_shiftjis);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13760 Qw32_charset_shiftjis = intern ("w32-charset-shiftjis");
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13761 staticpro (&Qw32_charset_hangeul);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13762 Qw32_charset_hangeul = intern ("w32-charset-hangeul");
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13763 staticpro (&Qw32_charset_chinesebig5);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13764 Qw32_charset_chinesebig5 = intern ("w32-charset-chinesebig5");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13765 staticpro (&Qw32_charset_gb2312);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13766 Qw32_charset_gb2312 = intern ("w32-charset-gb2312");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13767 staticpro (&Qw32_charset_oem);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13768 Qw32_charset_oem = intern ("w32-charset-oem");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13769
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13770 #ifdef JOHAB_CHARSET
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13771 {
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13772 static int w32_extra_charsets_defined = 1;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13773 DEFVAR_BOOL ("w32-extra-charsets-defined", &w32_extra_charsets_defined, "");
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13774
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13775 staticpro (&Qw32_charset_johab);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13776 Qw32_charset_johab = intern ("w32-charset-johab");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13777 staticpro (&Qw32_charset_easteurope);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13778 Qw32_charset_easteurope = intern ("w32-charset-easteurope");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13779 staticpro (&Qw32_charset_turkish);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13780 Qw32_charset_turkish = intern ("w32-charset-turkish");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13781 staticpro (&Qw32_charset_baltic);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13782 Qw32_charset_baltic = intern ("w32-charset-baltic");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13783 staticpro (&Qw32_charset_russian);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13784 Qw32_charset_russian = intern ("w32-charset-russian");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13785 staticpro (&Qw32_charset_arabic);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13786 Qw32_charset_arabic = intern ("w32-charset-arabic");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13787 staticpro (&Qw32_charset_greek);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13788 Qw32_charset_greek = intern ("w32-charset-greek");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13789 staticpro (&Qw32_charset_hebrew);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13790 Qw32_charset_hebrew = intern ("w32-charset-hebrew");
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13791 staticpro (&Qw32_charset_vietnamese);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13792 Qw32_charset_vietnamese = intern ("w32-charset-vietnamese");
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13793 staticpro (&Qw32_charset_thai);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13794 Qw32_charset_thai = intern ("w32-charset-thai");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13795 staticpro (&Qw32_charset_mac);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13796 Qw32_charset_mac = intern ("w32-charset-mac");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13797 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13798 #endif
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13799
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13800 #ifdef UNICODE_CHARSET
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13801 {
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13802 static int w32_unicode_charset_defined = 1;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13803 DEFVAR_BOOL ("w32-unicode-charset-defined",
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13804 &w32_unicode_charset_defined, "");
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13805
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13806 staticpro (&Qw32_charset_unicode);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13807 Qw32_charset_unicode = intern ("w32-charset-unicode");
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13808 #endif
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
13809
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13810 defsubr (&Sx_get_resource);
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13811 #if 0 /* TODO: Port to W32 */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13812 defsubr (&Sx_change_window_property);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13813 defsubr (&Sx_delete_window_property);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13814 defsubr (&Sx_window_property);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13815 #endif
26729
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25646
diff changeset
13816 defsubr (&Sxw_display_color_p);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13817 defsubr (&Sx_display_grayscale_p);
26729
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25646
diff changeset
13818 defsubr (&Sxw_color_defined_p);
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25646
diff changeset
13819 defsubr (&Sxw_color_values);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13820 defsubr (&Sx_server_max_request_size);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13821 defsubr (&Sx_server_vendor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13822 defsubr (&Sx_server_version);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13823 defsubr (&Sx_display_pixel_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13824 defsubr (&Sx_display_pixel_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13825 defsubr (&Sx_display_mm_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13826 defsubr (&Sx_display_mm_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13827 defsubr (&Sx_display_screens);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13828 defsubr (&Sx_display_planes);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13829 defsubr (&Sx_display_color_cells);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13830 defsubr (&Sx_display_visual_class);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13831 defsubr (&Sx_display_backing_store);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13832 defsubr (&Sx_display_save_under);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13833 defsubr (&Sx_parse_geometry);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13834 defsubr (&Sx_create_frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13835 defsubr (&Sx_open_connection);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13836 defsubr (&Sx_close_connection);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13837 defsubr (&Sx_display_list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13838 defsubr (&Sx_synchronize);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13839
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13840 /* W32 specific functions */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13841
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13842 defsubr (&Sw32_focus_frame);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13843 defsubr (&Sw32_select_font);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13844 defsubr (&Sw32_define_rgb_color);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13845 defsubr (&Sw32_default_color_map);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13846 defsubr (&Sw32_load_color_file);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
13847 defsubr (&Sw32_send_sys_command);
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
13848 defsubr (&Sw32_shell_execute);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13849 defsubr (&Sw32_register_hot_key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13850 defsubr (&Sw32_unregister_hot_key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13851 defsubr (&Sw32_registered_hot_keys);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
13852 defsubr (&Sw32_reconstruct_hot_key);
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
13853 defsubr (&Sw32_toggle_lock_key);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
13854 defsubr (&Sw32_find_bdf_fonts);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13855
34643
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13856 defsubr (&Sfile_system_info);
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
13857
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13858 /* Setting callback functions for fontset handler. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13859 get_font_info_func = w32_get_font_info;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13860
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13861 #if 0 /* This function pointer doesn't seem to be used anywhere.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13862 And the pointer assigned has the wrong type, anyway. */
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13863 list_fonts_func = w32_list_fonts;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13864 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13865
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13866 load_font_func = w32_load_font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13867 find_ccl_program_func = w32_find_ccl_program;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13868 query_font_func = w32_query_font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13869 set_frame_fontset_func = x_set_font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
13870 check_window_system_func = check_w32;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13871
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13872 #if 0 /* TODO Image support for W32 */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13873 /* Images. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13874 Qxbm = intern ("xbm");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13875 staticpro (&Qxbm);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13876 QCtype = intern (":type");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13877 staticpro (&QCtype);
35359
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
13878 QCconversion = intern (":conversion");
b5a2207901e0 (QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents: 35288
diff changeset
13879 staticpro (&QCconversion);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13880 QCheuristic_mask = intern (":heuristic-mask");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13881 staticpro (&QCheuristic_mask);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13882 QCcolor_symbols = intern (":color-symbols");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13883 staticpro (&QCcolor_symbols);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13884 QCascent = intern (":ascent");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13885 staticpro (&QCascent);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13886 QCmargin = intern (":margin");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13887 staticpro (&QCmargin);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13888 QCrelief = intern (":relief");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13889 staticpro (&QCrelief);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13890 Qpostscript = intern ("postscript");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13891 staticpro (&Qpostscript);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13892 QCloader = intern (":loader");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13893 staticpro (&QCloader);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13894 QCbounding_box = intern (":bounding-box");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13895 staticpro (&QCbounding_box);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13896 QCpt_width = intern (":pt-width");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13897 staticpro (&QCpt_width);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13898 QCpt_height = intern (":pt-height");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13899 staticpro (&QCpt_height);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13900 QCindex = intern (":index");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13901 staticpro (&QCindex);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13902 Qpbm = intern ("pbm");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13903 staticpro (&Qpbm);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13904
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13905 #if HAVE_XPM
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13906 Qxpm = intern ("xpm");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13907 staticpro (&Qxpm);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13908 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13909
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13910 #if HAVE_JPEG
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13911 Qjpeg = intern ("jpeg");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13912 staticpro (&Qjpeg);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13913 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13914
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13915 #if HAVE_TIFF
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13916 Qtiff = intern ("tiff");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13917 staticpro (&Qtiff);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13918 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13919
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13920 #if HAVE_GIF
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13921 Qgif = intern ("gif");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13922 staticpro (&Qgif);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13923 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13924
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13925 #if HAVE_PNG
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13926 Qpng = intern ("png");
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13927 staticpro (&Qpng);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13928 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13929
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13930 defsubr (&Sclear_image_cache);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13931
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13932 #if GLYPH_DEBUG
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13933 defsubr (&Simagep);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13934 defsubr (&Slookup_image);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13935 #endif
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13936 #endif /* TODO */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13937
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
13938 hourglass_atimer = NULL;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
13939 hourglass_shown_p = 0;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13940 #ifdef TODO /* Tooltip support not complete. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13941 defsubr (&Sx_show_tip);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13942 defsubr (&Sx_hide_tip);
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13943 #endif
34729
3dc60d80125f (syms_of_w32fns): Initialize and staticpro tip_frame.
Jason Rumney <jasonr@gnu.org>
parents: 34698
diff changeset
13944 tip_timer = Qnil;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13945 staticpro (&tip_timer);
34729
3dc60d80125f (syms_of_w32fns): Initialize and staticpro tip_frame.
Jason Rumney <jasonr@gnu.org>
parents: 34698
diff changeset
13946 tip_frame = Qnil;
3dc60d80125f (syms_of_w32fns): Initialize and staticpro tip_frame.
Jason Rumney <jasonr@gnu.org>
parents: 34698
diff changeset
13947 staticpro (&tip_frame);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13948
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13949 defsubr (&Sx_file_dialog);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13950 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13951
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13952
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13953 void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13954 init_xfns ()
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13955 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13956 image_types = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13957 Vimage_types = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13958
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13959 #if 0 /* TODO : Image support for W32 */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13960 define_image_type (&xbm_type);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13961 define_image_type (&gs_type);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13962 define_image_type (&pbm_type);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13963
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13964 #if HAVE_XPM
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13965 define_image_type (&xpm_type);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13966 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13967
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13968 #if HAVE_JPEG
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13969 define_image_type (&jpeg_type);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13970 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13971
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13972 #if HAVE_TIFF
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13973 define_image_type (&tiff_type);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13974 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13975
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13976 #if HAVE_GIF
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13977 define_image_type (&gif_type);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13978 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13979
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13980 #if HAVE_PNG
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13981 define_image_type (&png_type);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
13982 #endif
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
13983 #endif /* TODO */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13984 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13985
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13986 #undef abort
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13987
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13988 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
13989 w32_abort()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13990 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
13991 int button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
13992 button = MessageBox (NULL,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
13993 "A fatal error has occurred!\n\n"
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
13994 "Select Abort to exit, Retry to debug, Ignore to continue",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
13995 "Emacs Abort Dialog",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
13996 MB_ICONEXCLAMATION | MB_TASKMODAL
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
13997 | MB_SETFOREGROUND | MB_ABORTRETRYIGNORE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
13998 switch (button)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
13999 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
14000 case IDRETRY:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
14001 DebugBreak ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
14002 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
14003 case IDIGNORE:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
14004 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
14005 case IDABORT:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
14006 default:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
14007 abort ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
14008 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
14009 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
14010 }
15148
220145cf7546 (continuation of previous checkin)
Geoff Voelker <voelker@cs.washington.edu>
parents: 15147
diff changeset
14011
23801
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
14012 /* For convenience when debugging. */
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
14013 int
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
14014 w32_last_error()
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
14015 {
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
14016 return GetLastError ();
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
14017 }