annotate src/w32fns.c @ 25235:98c67187cd6b

(x_set_icon_type): Support setting frame icons.
author Geoff Voelker <voelker@cs.washington.edu>
date Tue, 10 Aug 1999 17:32:59 +0000
parents d89aa269255d
children 64b742df49ca
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.
15314
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2 Copyright (C) 1989, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4 This file is part of GNU Emacs.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7 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
8 the Free Software Foundation; either version 2, or (at your option)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9 any later version.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
10
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
14 GNU General Public License for more details.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
15
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
17 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
18 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
19 Boston, MA 02111-1307, USA. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
20
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
21 /* Added by Kevin Gallo */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
22
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
23 #include <config.h>
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
24
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
25 #include <signal.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
26 #include <stdio.h>
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
27 #include <limits.h>
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
28 #include <errno.h>
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
29
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
30 #include "lisp.h"
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
31 #include "charset.h"
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
32 #include "fontset.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
33 #include "w32term.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34 #include "frame.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
35 #include "window.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
36 #include "buffer.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
37 #include "dispextern.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
38 #include "keyboard.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
39 #include "blockinput.h"
24412
d11ac02f9d6a Use epaths.h istead of paths.h.
Richard M. Stallman <rms@gnu.org>
parents: 24339
diff changeset
40 #include "epaths.h"
16593
4ed80eda6fac Use new names for w32 files
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
41 #include "w32heap.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
42 #include "termhooks.h"
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
43 #include "coding.h"
25069
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
44 #include "ccl.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
46 #include <commdlg.h>
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
47 #include <shellapi.h>
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
48
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
49 extern void abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50 extern void free_frame_menubar ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
51 extern struct scroll_bar *x_window_to_scroll_bar ();
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
52 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
53 extern int quit_char;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
54
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
55 extern char *lispy_function_keys[];
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
56
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
57 /* 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
58 Lisp_Object Vw32_color_map;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
59
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
60 /* 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
61 Lisp_Object Vw32_pass_alt_to_system;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
62
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
63 /* 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
64 to alt_modifier. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
65 Lisp_Object Vw32_alt_is_meta;
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
66
24339
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
67 /* 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
68 Lisp_Object Vw32_quit_key;
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
69
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
70 /* 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
71 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
72 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
73
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
74 /* 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
75 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
76 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
77
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
78 /* 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
79 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
80 Lisp_Object Vw32_phantom_key_code;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
81
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
82 /* 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
83 normal key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
84 Lisp_Object Vw32_lwindow_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
85
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
86 /* 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
87 normal key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
88 Lisp_Object Vw32_rwindow_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
89
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
90 /* 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
91 key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
92 Lisp_Object Vw32_apps_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
93
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
94 /* 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
95 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
96
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
97 /* 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
98 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
99
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
100 /* 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
101 Lisp_Object Vw32_scroll_lock_modifier;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
102
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
103 /* Switch to control whether we inhibit requests for italicised fonts (which
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
104 are synthesized, look ugly, and are trashed by cursor movement under NT). */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
105 Lisp_Object Vw32_enable_italics;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
106
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
107 /* Enable palette management. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
108 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
109
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
110 /* 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
111 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
112 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
113
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
114 /* 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
115 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
116 Lisp_Object Vw32_mouse_move_interval;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
117
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
118 /* The name we're using in resource queries. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
119 Lisp_Object Vx_resource_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
120
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
121 /* Non nil if no window manager is in use. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
122 Lisp_Object Vx_no_window_manager;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
123
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
124 /* The background and shape of the mouse pointer, and shape when not
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
125 over text or in the modeline. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
126 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
127 /* The shape when over mouse-sensitive text. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
128 Lisp_Object Vx_sensitive_text_pointer_shape;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
129
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
130 /* Color of chars displayed in cursor box. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
131 Lisp_Object Vx_cursor_fore_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
132
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
133 /* Nonzero if using Windows. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
134 static int w32_in_use;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
135
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
136 /* Search path for bitmap files. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
137 Lisp_Object Vx_bitmap_file_path;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
138
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
139 /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
140 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
141
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
142 /* 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
143 Lisp_Object Vw32_bdf_filename_alist;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
144
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
145 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
146
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
147 /* 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
148 int w32_strict_fontnames;
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
149
24695
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
150 /* 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
151 indicates there is an update region. */
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
152 int w32_strict_painting;
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
153
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
154 /* Evaluate this expression to rebuild the section of syms_of_w32fns
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
155 that initializes and staticpros the symbols declared below. Note
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
156 that Emacs 18 has a bug that keeps C-x C-e from being able to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
157 evaluate this expression.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
158
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
159 (progn
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
160 ;; Accumulate a list of the symbols we want to initialize from the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
161 ;; declarations at the top of the file.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
162 (goto-char (point-min))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
163 (search-forward "/\*&&& symbols declared here &&&*\/\n")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
164 (let (symbol-list)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
165 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
166 (setq symbol-list
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
167 (cons (buffer-substring (match-beginning 1) (match-end 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
168 symbol-list))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
169 (forward-line 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
170 (setq symbol-list (nreverse symbol-list))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
171 ;; Delete the section of syms_of_... where we initialize the symbols.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
172 (search-forward "\n /\*&&& init symbols here &&&*\/\n")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
173 (let ((start (point)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
174 (while (looking-at "^ Q")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
175 (forward-line 2))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
176 (kill-region start (point)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
177 ;; Write a new symbol initialization section.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
178 (while symbol-list
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
179 (insert (format " %s = intern (\"" (car symbol-list)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
180 (let ((start (point)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
181 (insert (substring (car symbol-list) 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
182 (subst-char-in-region start (point) ?_ ?-))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
183 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
184 (setq symbol-list (cdr symbol-list)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
185
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
186 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
187
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
188 /*&&& symbols declared here &&&*/
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
189 Lisp_Object Qauto_raise;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
190 Lisp_Object Qauto_lower;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
191 Lisp_Object Qbackground_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
192 Lisp_Object Qbar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
193 Lisp_Object Qborder_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
194 Lisp_Object Qborder_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
195 Lisp_Object Qbox;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
196 Lisp_Object Qcursor_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
197 Lisp_Object Qcursor_type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
198 Lisp_Object Qforeground_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
199 Lisp_Object Qgeometry;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
200 Lisp_Object Qicon_left;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
201 Lisp_Object Qicon_top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
202 Lisp_Object Qicon_type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
203 Lisp_Object Qicon_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
204 Lisp_Object Qinternal_border_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
205 Lisp_Object Qleft;
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
206 Lisp_Object Qright;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
207 Lisp_Object Qmouse_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
208 Lisp_Object Qnone;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
209 Lisp_Object Qparent_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
210 Lisp_Object Qscroll_bar_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
211 Lisp_Object Qsuppress_icon;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
212 Lisp_Object Qtop;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
213 Lisp_Object Qundefined_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
214 Lisp_Object Qvertical_scroll_bars;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
215 Lisp_Object Qvisibility;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
216 Lisp_Object Qwindow_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
217 Lisp_Object Qx_frame_parameter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
218 Lisp_Object Qx_resource_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
219 Lisp_Object Quser_position;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
220 Lisp_Object Quser_size;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
221 Lisp_Object Qdisplay;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
222
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
223 Lisp_Object Qhyper;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
224 Lisp_Object Qsuper;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
225 Lisp_Object Qmeta;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
226 Lisp_Object Qalt;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
227 Lisp_Object Qctrl;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
228 Lisp_Object Qcontrol;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
229 Lisp_Object Qshift;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
230
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
231 /* 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
232 #define LMOUSE 1
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
233 #define MMOUSE 2
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
234 #define RMOUSE 4
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
235
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
236 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
237 static W32Msg saved_mouse_button_msg;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
238 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
239 static W32Msg saved_mouse_move_msg;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
240 static unsigned mouse_move_timer;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
241
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
242 /* W95 mousewheel handler */
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
243 unsigned int msh_mousewheel = 0;
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
244
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
245 #define MOUSE_BUTTON_ID 1
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
246 #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
247
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
248 /* The below are defined in frame.c. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
249 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
250 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
251
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
252 extern Lisp_Object Vwindow_system_version;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
253
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
254 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
255
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
256 extern Lisp_Object last_mouse_scroll_bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
257 extern int last_mouse_scroll_bar_pos;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
258
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
259 /* From w32term.c. */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
260 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
261 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
262
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
263
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
264 /* 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
265 void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
266 check_w32 ()
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
267 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
268 if (! w32_in_use)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
269 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
270 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
271
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
272 /* Nonzero if we can use mouse menus.
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
273 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
274
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
275 int
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
276 have_menus_p ()
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
277 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
278 return w32_in_use;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
279 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
280
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
281 /* 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
282 and checking validity for W32. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
283
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
284 FRAME_PTR
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
285 check_x_frame (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
286 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
287 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
288 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
289
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
290 if (NILP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
291 f = selected_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
292 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
293 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
294 CHECK_LIVE_FRAME (frame, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
295 f = XFRAME (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
296 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
297 if (! FRAME_W32_P (f))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
298 error ("non-w32 frame used");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
299 return f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
300 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
301
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
302 /* 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
303 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
304 the first display on the list. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
305
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
306 static struct w32_display_info *
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
307 check_x_display_info (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
308 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
309 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
310 if (NILP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
311 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
312 if (FRAME_W32_P (selected_frame))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
313 return FRAME_W32_DISPLAY_INFO (selected_frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
314 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
315 return &one_w32_display_info;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
316 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
317 else if (STRINGP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
318 return x_display_info_for_name (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
319 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
320 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
321 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
322
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
323 CHECK_LIVE_FRAME (frame, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
324 f = XFRAME (frame);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
325 if (! FRAME_W32_P (f))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
326 error ("non-w32 frame used");
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
327 return FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
328 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
329 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
330
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
331 /* Return the Emacs frame-object corresponding to an w32 window.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
332 It could be the frame's main window or an icon window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
333
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
334 /* 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
335
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
336 struct frame *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
337 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
338 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
339 HWND wdesc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
340 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
341 Lisp_Object tail, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
342 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
343
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
344 for (tail = Vframe_list; GC_CONSP (tail); tail = XCONS (tail)->cdr)
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 frame = XCONS (tail)->car;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
347 if (!GC_FRAMEP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
348 continue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
349 f = XFRAME (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
350 if (f->output_data.nothing == 1
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
351 || FRAME_W32_DISPLAY_INFO (f) != dpyinfo)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
352 continue;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
353 if (FRAME_W32_WINDOW (f) == wdesc)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
354 return f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
355 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
356 return 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
357 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
358
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
359
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
360
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
361 /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
362 id, which is just an int that this section returns. Bitmaps are
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
363 reference counted so they can be shared among frames.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
364
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
365 Bitmap indices are guaranteed to be > 0, so a negative number can
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
366 be used to indicate no bitmap.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
367
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
368 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
369 the bitmaps yourself. That is, creating a bitmap from the same
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
370 data more than once will not be caught. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
371
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
372
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
373 /* Functions to access the contents of a bitmap, given an id. */
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 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
376 x_bitmap_height (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
377 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
378 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
379 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
380 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].height;
13434
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
383 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
384 x_bitmap_width (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
385 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
386 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
387 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
388 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].width;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
389 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
390
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
391 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
392 x_bitmap_pixmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
393 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
394 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
395 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
396 return (int) FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
397 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
398
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
399
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
400 /* Allocate a new bitmap record. Returns index of new record. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
401
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
402 static int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
403 x_allocate_bitmap_record (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
404 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
405 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
406 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
407 int i;
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 if (dpyinfo->bitmaps == NULL)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
410 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
411 dpyinfo->bitmaps_size = 10;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
412 dpyinfo->bitmaps
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
413 = (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
414 dpyinfo->bitmaps_last = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
415 return 1;
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
418 if (dpyinfo->bitmaps_last < dpyinfo->bitmaps_size)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
419 return ++dpyinfo->bitmaps_last;
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 for (i = 0; i < dpyinfo->bitmaps_size; ++i)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
422 if (dpyinfo->bitmaps[i].refcount == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
423 return i + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
424
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
425 dpyinfo->bitmaps_size *= 2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
426 dpyinfo->bitmaps
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
427 = (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
428 dpyinfo->bitmaps_size * sizeof (struct w32_bitmap_record));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
429 return ++dpyinfo->bitmaps_last;
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 /* 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
433
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
434 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
435 x_reference_bitmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
436 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
437 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
438 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
439 ++FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].refcount;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
440 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
441
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
442 /* 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
443
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
444 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
445 x_create_bitmap_from_data (f, bits, width, height)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
446 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
447 char *bits;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
448 unsigned int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
449 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
450 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
451 Pixmap bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
452 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
453
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
454 bitmap = CreateBitmap (width, height,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
455 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
456 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_cbits,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
457 bits);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
458
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
459 if (! bitmap)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
460 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
461
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
462 id = x_allocate_bitmap_record (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
463 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
464 dpyinfo->bitmaps[id - 1].file = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
465 dpyinfo->bitmaps[id - 1].hinst = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
466 dpyinfo->bitmaps[id - 1].refcount = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
467 dpyinfo->bitmaps[id - 1].depth = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
468 dpyinfo->bitmaps[id - 1].height = height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
469 dpyinfo->bitmaps[id - 1].width = width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
470
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
471 return id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
472 }
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 /* Create bitmap from file FILE for frame F. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
475
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
476 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
477 x_create_bitmap_from_file (f, file)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
478 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
479 Lisp_Object file;
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 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
482 #if 0
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
483 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
484 unsigned int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
485 Pixmap bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
486 int xhot, yhot, result, id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
487 Lisp_Object found;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
488 int fd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
489 char *filename;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
490 HINSTANCE hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
491
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
492 /* Look for an existing bitmap with the same name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
493 for (id = 0; id < dpyinfo->bitmaps_last; ++id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
494 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
495 if (dpyinfo->bitmaps[id].refcount
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
496 && dpyinfo->bitmaps[id].file
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
497 && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
498 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
499 ++dpyinfo->bitmaps[id].refcount;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
500 return id + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
501 }
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
504 /* Search bitmap-file-path for the file, if appropriate. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
505 fd = openp (Vx_bitmap_file_path, file, "", &found, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
506 if (fd < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
507 return -1;
23407
4587be644789 (x_create_bitmap_from_file): Skip special files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23314
diff changeset
508 /* LoadLibraryEx won't handle special files handled by Emacs handler. */
4587be644789 (x_create_bitmap_from_file): Skip special files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23314
diff changeset
509 if (fd == 0)
4587be644789 (x_create_bitmap_from_file): Skip special files.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23314
diff changeset
510 return -1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
511 close (fd);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
512
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
513 filename = (char *) XSTRING (found)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
514
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
515 hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
516
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
517 if (hinst == NULL)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
518 return -1;
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
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
521 result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
522 filename, &width, &height, &bitmap, &xhot, &yhot);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
523 if (result != BitmapSuccess)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
524 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
525
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
526 id = x_allocate_bitmap_record (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
527 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
528 dpyinfo->bitmaps[id - 1].refcount = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
529 dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
530 dpyinfo->bitmaps[id - 1].depth = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
531 dpyinfo->bitmaps[id - 1].height = height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
532 dpyinfo->bitmaps[id - 1].width = width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
533 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
534
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
535 return id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
536 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
537 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
538
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
539 /* Remove reference to bitmap with id number ID. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
540
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
541 void
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
542 x_destroy_bitmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
543 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
544 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
545 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
546 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
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 if (id > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
549 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
550 --dpyinfo->bitmaps[id - 1].refcount;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
551 if (dpyinfo->bitmaps[id - 1].refcount == 0)
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 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
554 DeleteObject (dpyinfo->bitmaps[id - 1].pixmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
555 if (dpyinfo->bitmaps[id - 1].file)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
556 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
557 free (dpyinfo->bitmaps[id - 1].file);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
558 dpyinfo->bitmaps[id - 1].file = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
559 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
560 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
561 }
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 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
564
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
565 /* Free all the bitmaps for the display specified by DPYINFO. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
566
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
567 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
568 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
569 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
570 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
571 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
572 for (i = 0; i < dpyinfo->bitmaps_last; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
573 if (dpyinfo->bitmaps[i].refcount > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
574 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
575 DeleteObject (dpyinfo->bitmaps[i].pixmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
576 if (dpyinfo->bitmaps[i].file)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
577 free (dpyinfo->bitmaps[i].file);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
578 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
579 dpyinfo->bitmaps_last = 0;
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
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
582 /* Connect the frame-parameter names for W32 frames
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
583 to the ways of passing the parameter values to the window system.
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 The name of a parameter, as a Lisp symbol,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
586 has an `x-frame-parameter' property which is an integer in Lisp
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
587 but can be interpreted as an `enum x_frame_parm' in C. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
588
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
589 enum x_frame_parm
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
590 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
591 X_PARM_FOREGROUND_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
592 X_PARM_BACKGROUND_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
593 X_PARM_MOUSE_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
594 X_PARM_CURSOR_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
595 X_PARM_BORDER_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
596 X_PARM_ICON_TYPE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
597 X_PARM_FONT,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
598 X_PARM_BORDER_WIDTH,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
599 X_PARM_INTERNAL_BORDER_WIDTH,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
600 X_PARM_NAME,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
601 X_PARM_AUTORAISE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
602 X_PARM_AUTOLOWER,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
603 X_PARM_VERT_SCROLL_BAR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
604 X_PARM_VISIBILITY,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
605 X_PARM_MENU_BAR_LINES
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
606 };
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 struct x_frame_parm_table
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 char *name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
612 void (*setter)( /* struct frame *frame, Lisp_Object val, oldval */ );
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
613 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
614
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
615 void x_set_foreground_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
616 void x_set_background_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
617 void x_set_mouse_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
618 void x_set_cursor_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
619 void x_set_border_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
620 void x_set_cursor_type ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
621 void x_set_icon_type ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
622 void x_set_icon_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
623 void x_set_font ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
624 void x_set_border_width ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
625 void x_set_internal_border_width ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
626 void x_explicitly_set_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
627 void x_set_autoraise ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
628 void x_set_autolower ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
629 void x_set_vertical_scroll_bars ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
630 void x_set_visibility ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
631 void x_set_menu_bar_lines ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
632 void x_set_scroll_bar_width ();
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
633 void x_set_title ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
634 void x_set_unsplittable ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
635
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
636 static struct x_frame_parm_table x_frame_parms[] =
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
637 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
638 "auto-raise", x_set_autoraise,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
639 "auto-lower", x_set_autolower,
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
640 "background-color", x_set_background_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
641 "border-color", x_set_border_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
642 "border-width", x_set_border_width,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
643 "cursor-color", x_set_cursor_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
644 "cursor-type", x_set_cursor_type,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
645 "font", x_set_font,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
646 "foreground-color", x_set_foreground_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
647 "icon-name", x_set_icon_name,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
648 "icon-type", x_set_icon_type,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
649 "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
650 "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
651 "mouse-color", x_set_mouse_color,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
652 "name", x_explicitly_set_name,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
653 "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
654 "title", x_set_title,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
655 "unsplittable", x_set_unsplittable,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
656 "vertical-scroll-bars", x_set_vertical_scroll_bars,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
657 "visibility", x_set_visibility,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
658 };
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 /* 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
661 the Lisp symbol names of parameters relevant to W32. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
662
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
663 init_x_parm_symbols ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
664 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
665 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
666
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
667 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
668 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
669 make_number (i));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
670 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
671
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
672 /* Change the parameters of FRAME as specified by ALIST.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
673 If a parameter is not specially recognized, do nothing;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
674 otherwise call the `x_set_...' function for that parameter. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
675
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
676 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
677 x_set_frame_parameters (f, alist)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
678 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
679 Lisp_Object alist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
680 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
681 Lisp_Object tail;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
682
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
683 /* If both of these parameters are present, it's more efficient to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
684 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
685 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
686 int width, height;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
687
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
688 /* Same here. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
689 Lisp_Object left, top;
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 /* Same with these. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
692 Lisp_Object icon_left, icon_top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
693
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
694 /* Record in these vectors all the parms specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
695 Lisp_Object *parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
696 Lisp_Object *values;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
697 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
698 int left_no_change = 0, top_no_change = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
699 int icon_left_no_change = 0, icon_top_no_change = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
700
24211
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
701 struct gcpro gcpro1, gcpro2;
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
702
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
703 i = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
704 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
705 i++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
706
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
707 parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
708 values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
709
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
710 /* Extract parm names and values into those vectors. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
711
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
712 i = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
713 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
714 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
715 Lisp_Object elt, prop, val;
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 elt = Fcar (tail);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
718 parms[i] = Fcar (elt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
719 values[i] = Fcdr (elt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
720 i++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
721 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
722
24211
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
723 /* 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
724 alist = tail = Qnil;
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
725
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
726 GCPRO2 (*parms, *values);
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
727 gcpro1.nvars = i;
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
728 gcpro2.nvars = i;
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
729
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
730 /* 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
731 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
732 top = left = Qunbound;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
733 icon_left = icon_top = Qunbound;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
734
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
735 /* Provide default values for HEIGHT and WIDTH. */
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
736 width = FRAME_WIDTH (f);
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
737 height = FRAME_HEIGHT (f);
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
738
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
739 /* Now process them in reverse of specified order. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
740 for (i--; i >= 0; i--)
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 Lisp_Object prop, val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
743
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
744 prop = parms[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
745 val = values[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
746
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
747 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
748 width = XFASTINT (val);
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
749 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
750 height = XFASTINT (val);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
751 else if (EQ (prop, Qtop))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
752 top = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
753 else if (EQ (prop, Qleft))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
754 left = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
755 else if (EQ (prop, Qicon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
756 icon_top = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
757 else if (EQ (prop, Qicon_left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
758 icon_left = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
759 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
760 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
761 register Lisp_Object param_index, old_value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
762
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
763 param_index = Fget (prop, Qx_frame_parameter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
764 old_value = get_frame_param (f, prop);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
765 store_frame_param (f, prop, val);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
766 if (NATNUMP (param_index)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
767 && (XFASTINT (param_index)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
768 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
769 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value);
13434
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 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
772
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
773 /* Don't die if just one of these was set. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
774 if (EQ (left, Qunbound))
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 left_no_change = 1;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
777 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
778 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
779 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
780 XSETINT (left, f->output_data.w32->left_pos);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
781 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
782 if (EQ (top, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
783 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
784 top_no_change = 1;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
785 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
786 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
787 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
788 XSETINT (top, f->output_data.w32->top_pos);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
789 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
790
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
791 /* 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
792 if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
793 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
794 icon_left_no_change = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
795 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
796 if (NILP (icon_left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
797 XSETINT (icon_left, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
798 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
799 if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
800 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
801 icon_top_no_change = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
802 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
803 if (NILP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
804 XSETINT (icon_top, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
805 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
806
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
807 /* Don't set these parameters unless they've been explicitly
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
808 specified. The window might be mapped or resized while we're in
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
809 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
810 code has asked for it.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
811
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
812 Don't set these parameters unless they actually differ from the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
813 window's current parameters; the window may not actually exist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
814 yet. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
815 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
816 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
817
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
818 check_frame_size (f, &height, &width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
819
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
820 XSETFRAME (frame, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
821
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
822 if (XINT (width) != FRAME_WIDTH (f)
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
823 || XINT (height) != FRAME_HEIGHT (f))
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
824 Fset_frame_size (frame, make_number (width), make_number (height));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
825
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
826 if ((!NILP (left) || !NILP (top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
827 && ! (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
828 && ! (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
829 && NUMBERP (top) && XINT (top) == f->output_data.w32->top_pos))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
830 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
831 int leftpos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
832 int toppos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
833
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
834 /* Record the signs. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
835 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
836 if (EQ (left, Qminus))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
837 f->output_data.w32->size_hint_flags |= XNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
838 else if (INTEGERP (left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
839 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
840 leftpos = XINT (left);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
841 if (leftpos < 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
842 f->output_data.w32->size_hint_flags |= XNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
843 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
844 else if (CONSP (left) && EQ (XCONS (left)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
845 && CONSP (XCONS (left)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
846 && INTEGERP (XCONS (XCONS (left)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
847 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
848 leftpos = - XINT (XCONS (XCONS (left)->cdr)->car);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
849 f->output_data.w32->size_hint_flags |= XNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
850 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
851 else if (CONSP (left) && EQ (XCONS (left)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
852 && CONSP (XCONS (left)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
853 && INTEGERP (XCONS (XCONS (left)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
854 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
855 leftpos = XINT (XCONS (XCONS (left)->cdr)->car);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
856 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
857
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
858 if (EQ (top, Qminus))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
859 f->output_data.w32->size_hint_flags |= YNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
860 else if (INTEGERP (top))
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 toppos = XINT (top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
863 if (toppos < 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
864 f->output_data.w32->size_hint_flags |= YNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
865 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
866 else if (CONSP (top) && EQ (XCONS (top)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
867 && CONSP (XCONS (top)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
868 && INTEGERP (XCONS (XCONS (top)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
869 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
870 toppos = - XINT (XCONS (XCONS (top)->cdr)->car);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
871 f->output_data.w32->size_hint_flags |= YNegative;
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 else if (CONSP (top) && EQ (XCONS (top)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
874 && CONSP (XCONS (top)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
875 && INTEGERP (XCONS (XCONS (top)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
876 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
877 toppos = XINT (XCONS (XCONS (top)->cdr)->car);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
878 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
879
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 /* 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
882 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
883 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
884
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
885 f->output_data.w32->win_gravity = NorthWestGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
886
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
887 /* Actually set that position, and convert to absolute. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
888 x_set_offset (f, leftpos, toppos, -1);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
891 if ((!NILP (icon_left) || !NILP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
892 && ! (icon_left_no_change && icon_top_no_change))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
893 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
894 }
24211
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
895
9ecc7b851682 (x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents: 24206
diff changeset
896 UNGCPRO;
13434
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
899 /* Store the screen positions of frame F into XPTR and YPTR.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
900 These are the positions of the containing window manager window,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
901 not Emacs's own window. */
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 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
904 x_real_positions (f, xptr, yptr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
905 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
906 int *xptr, *yptr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
907 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
908 POINT pt;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
909
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
910 {
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
911 RECT rect;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
912
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
913 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
914 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
915
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
916 pt.x = rect.left;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
917 pt.y = rect.top;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
918 }
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
919
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
920 ClientToScreen (FRAME_W32_WINDOW(f), &pt);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
921
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
922 *xptr = pt.x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
923 *yptr = pt.y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
924 }
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 /* Insert a description of internally-recorded parameters of frame X
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
927 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
928 Only parameters that are specific to W32
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
929 and whose values are not correctly recorded in the frame's
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
930 param_alist need to be considered here. */
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 x_report_frame_params (f, alistptr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
933 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
934 Lisp_Object *alistptr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
935 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
936 char buf[16];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
937 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
938
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
939 /* Represent negative positions (off the top or left screen edge)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
940 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
941 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
942 if (f->output_data.w32->left_pos >= 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
943 store_in_alist (alistptr, Qleft, tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
944 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
945 store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
946
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
947 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
948 if (f->output_data.w32->top_pos >= 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
949 store_in_alist (alistptr, Qtop, tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
950 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
951 store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
952
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
953 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
954 make_number (f->output_data.w32->border_width));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
955 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
956 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
957 sprintf (buf, "%ld", (long) FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
958 store_in_alist (alistptr, Qwindow_id,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
959 build_string (buf));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
960 store_in_alist (alistptr, Qicon_name, f->icon_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
961 FRAME_SAMPLE_VISIBILITY (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
962 store_in_alist (alistptr, Qvisibility,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
963 (FRAME_VISIBLE_P (f) ? Qt
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
964 : FRAME_ICONIFIED_P (f) ? Qicon : Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
965 store_in_alist (alistptr, Qdisplay,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
966 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->car);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
967 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
968
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
969
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
970 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
971 "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
972 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
973 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
974 (red, green, blue, name)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
975 Lisp_Object red, green, blue, name;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
976 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
977 Lisp_Object rgb;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
978 Lisp_Object oldrgb = Qnil;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
979 Lisp_Object entry;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
980
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
981 CHECK_NUMBER (red, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
982 CHECK_NUMBER (green, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
983 CHECK_NUMBER (blue, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
984 CHECK_STRING (name, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
985
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
986 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
987
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
988 BLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
989
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
990 /* 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
991 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
992 if (NILP (entry))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
993 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
994 entry = Fcons (name, rgb);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
995 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
996 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
997 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
998 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
999 oldrgb = Fcdr (entry);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1000 Fsetcdr (entry, rgb);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1001 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1002
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1003 UNBLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1004
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1005 return (oldrgb);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1006 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1007
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1008 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
1009 "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
1010 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
1011 \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1012 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
1013 R G B name\n\
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1014 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
1015 (filename)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1016 Lisp_Object filename;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1017 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1018 FILE *fp;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1019 Lisp_Object cmap = Qnil;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1020 Lisp_Object abspath;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1021
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1022 CHECK_STRING (filename, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1023 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
1024
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1025 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
1026 if (fp)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1027 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1028 char buf[512];
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1029 int red, green, blue;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1030 int num;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1031
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1032 BLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1033
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1034 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
1035 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
1036 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1037 char *name = buf + num;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1038 num = strlen (name) - 1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1039 if (name[num] == '\n')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1040 name[num] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1041 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
1042 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
1043 cmap);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1044 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1045 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1046 fclose (fp);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1047
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1048 UNBLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1049 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1050
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1051 return cmap;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1052 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1053
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1054 /* The default colors for the w32 color map */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1055 typedef struct colormap_t
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1056 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1057 char *name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1058 COLORREF colorref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1059 } colormap_t;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1060
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1061 colormap_t w32_color_map[] =
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1062 {
14983
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1063 {"snow" , PALETTERGB (255,250,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1064 {"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
1065 {"GhostWhite" , PALETTERGB (248,248,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1066 {"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
1067 {"WhiteSmoke" , PALETTERGB (245,245,245)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1068 {"gainsboro" , PALETTERGB (220,220,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1069 {"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
1070 {"FloralWhite" , PALETTERGB (255,250,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1071 {"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
1072 {"OldLace" , PALETTERGB (253,245,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1073 {"linen" , PALETTERGB (250,240,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1074 {"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
1075 {"AntiqueWhite" , PALETTERGB (250,235,215)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1076 {"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
1077 {"PapayaWhip" , PALETTERGB (255,239,213)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1078 {"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
1079 {"BlanchedAlmond" , PALETTERGB (255,235,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1080 {"bisque" , PALETTERGB (255,228,196)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1081 {"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
1082 {"PeachPuff" , PALETTERGB (255,218,185)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1083 {"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
1084 {"NavajoWhite" , PALETTERGB (255,222,173)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1085 {"moccasin" , PALETTERGB (255,228,181)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1086 {"cornsilk" , PALETTERGB (255,248,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1087 {"ivory" , PALETTERGB (255,255,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1088 {"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
1089 {"LemonChiffon" , PALETTERGB (255,250,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1090 {"seashell" , PALETTERGB (255,245,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1091 {"honeydew" , PALETTERGB (240,255,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1092 {"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
1093 {"MintCream" , PALETTERGB (245,255,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1094 {"azure" , PALETTERGB (240,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1095 {"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
1096 {"AliceBlue" , PALETTERGB (240,248,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1097 {"lavender" , PALETTERGB (230,230,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1098 {"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
1099 {"LavenderBlush" , PALETTERGB (255,240,245)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1100 {"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
1101 {"MistyRose" , PALETTERGB (255,228,225)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1102 {"white" , PALETTERGB (255,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1103 {"black" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1104 {"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
1105 {"DarkSlateGray" , PALETTERGB ( 47, 79, 79)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1106 {"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
1107 {"DarkSlateGrey" , PALETTERGB ( 47, 79, 79)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1108 {"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
1109 {"DimGray" , PALETTERGB (105,105,105)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1110 {"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
1111 {"DimGrey" , PALETTERGB (105,105,105)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1112 {"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
1113 {"SlateGray" , PALETTERGB (112,128,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1114 {"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
1115 {"SlateGrey" , PALETTERGB (112,128,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1116 {"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
1117 {"LightSlateGray" , PALETTERGB (119,136,153)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1118 {"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
1119 {"LightSlateGrey" , PALETTERGB (119,136,153)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1120 {"gray" , PALETTERGB (190,190,190)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1121 {"grey" , PALETTERGB (190,190,190)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1122 {"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
1123 {"LightGrey" , PALETTERGB (211,211,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1124 {"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
1125 {"LightGray" , PALETTERGB (211,211,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1126 {"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
1127 {"MidnightBlue" , PALETTERGB ( 25, 25,112)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1128 {"navy" , PALETTERGB ( 0, 0,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1129 {"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
1130 {"NavyBlue" , PALETTERGB ( 0, 0,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1131 {"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
1132 {"CornflowerBlue" , PALETTERGB (100,149,237)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1133 {"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
1134 {"DarkSlateBlue" , PALETTERGB ( 72, 61,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1135 {"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
1136 {"SlateBlue" , PALETTERGB (106, 90,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1137 {"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
1138 {"MediumSlateBlue" , PALETTERGB (123,104,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1139 {"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
1140 {"LightSlateBlue" , PALETTERGB (132,112,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1141 {"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
1142 {"MediumBlue" , PALETTERGB ( 0, 0,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1143 {"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
1144 {"RoyalBlue" , PALETTERGB ( 65,105,225)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1145 {"blue" , PALETTERGB ( 0, 0,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1146 {"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
1147 {"DodgerBlue" , PALETTERGB ( 30,144,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1148 {"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
1149 {"DeepSkyBlue" , PALETTERGB ( 0,191,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1150 {"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
1151 {"SkyBlue" , PALETTERGB (135,206,235)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1152 {"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
1153 {"LightSkyBlue" , PALETTERGB (135,206,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1154 {"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
1155 {"SteelBlue" , PALETTERGB ( 70,130,180)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1156 {"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
1157 {"LightSteelBlue" , PALETTERGB (176,196,222)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1158 {"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
1159 {"LightBlue" , PALETTERGB (173,216,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1160 {"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
1161 {"PowderBlue" , PALETTERGB (176,224,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1162 {"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
1163 {"PaleTurquoise" , PALETTERGB (175,238,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1164 {"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
1165 {"DarkTurquoise" , PALETTERGB ( 0,206,209)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1166 {"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
1167 {"MediumTurquoise" , PALETTERGB ( 72,209,204)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1168 {"turquoise" , PALETTERGB ( 64,224,208)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1169 {"cyan" , PALETTERGB ( 0,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1170 {"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
1171 {"LightCyan" , PALETTERGB (224,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1172 {"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
1173 {"CadetBlue" , PALETTERGB ( 95,158,160)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1174 {"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
1175 {"MediumAquamarine" , PALETTERGB (102,205,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1176 {"aquamarine" , PALETTERGB (127,255,212)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1177 {"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
1178 {"DarkGreen" , PALETTERGB ( 0,100, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1179 {"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
1180 {"DarkOliveGreen" , PALETTERGB ( 85,107, 47)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1181 {"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
1182 {"DarkSeaGreen" , PALETTERGB (143,188,143)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1183 {"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
1184 {"SeaGreen" , PALETTERGB ( 46,139, 87)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1185 {"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
1186 {"MediumSeaGreen" , PALETTERGB ( 60,179,113)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1187 {"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
1188 {"LightSeaGreen" , PALETTERGB ( 32,178,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1189 {"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
1190 {"PaleGreen" , PALETTERGB (152,251,152)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1191 {"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
1192 {"SpringGreen" , PALETTERGB ( 0,255,127)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1193 {"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
1194 {"LawnGreen" , PALETTERGB (124,252, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1195 {"green" , PALETTERGB ( 0,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1196 {"chartreuse" , PALETTERGB (127,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1197 {"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
1198 {"MediumSpringGreen" , PALETTERGB ( 0,250,154)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1199 {"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
1200 {"GreenYellow" , PALETTERGB (173,255, 47)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1201 {"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
1202 {"LimeGreen" , PALETTERGB ( 50,205, 50)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1203 {"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
1204 {"YellowGreen" , PALETTERGB (154,205, 50)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1205 {"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
1206 {"ForestGreen" , PALETTERGB ( 34,139, 34)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1207 {"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
1208 {"OliveDrab" , PALETTERGB (107,142, 35)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1209 {"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
1210 {"DarkKhaki" , PALETTERGB (189,183,107)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1211 {"khaki" , PALETTERGB (240,230,140)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1212 {"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
1213 {"PaleGoldenrod" , PALETTERGB (238,232,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1214 {"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
1215 {"LightGoldenrodYellow" , PALETTERGB (250,250,210)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1216 {"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
1217 {"LightYellow" , PALETTERGB (255,255,224)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1218 {"yellow" , PALETTERGB (255,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1219 {"gold" , PALETTERGB (255,215, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1220 {"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
1221 {"LightGoldenrod" , PALETTERGB (238,221,130)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1222 {"goldenrod" , PALETTERGB (218,165, 32)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1223 {"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
1224 {"DarkGoldenrod" , PALETTERGB (184,134, 11)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1225 {"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
1226 {"RosyBrown" , PALETTERGB (188,143,143)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1227 {"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
1228 {"IndianRed" , PALETTERGB (205, 92, 92)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1229 {"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
1230 {"SaddleBrown" , PALETTERGB (139, 69, 19)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1231 {"sienna" , PALETTERGB (160, 82, 45)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1232 {"peru" , PALETTERGB (205,133, 63)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1233 {"burlywood" , PALETTERGB (222,184,135)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1234 {"beige" , PALETTERGB (245,245,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1235 {"wheat" , PALETTERGB (245,222,179)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1236 {"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
1237 {"SandyBrown" , PALETTERGB (244,164, 96)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1238 {"tan" , PALETTERGB (210,180,140)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1239 {"chocolate" , PALETTERGB (210,105, 30)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1240 {"firebrick" , PALETTERGB (178,34, 34)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1241 {"brown" , PALETTERGB (165,42, 42)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1242 {"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
1243 {"DarkSalmon" , PALETTERGB (233,150,122)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1244 {"salmon" , PALETTERGB (250,128,114)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1245 {"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
1246 {"LightSalmon" , PALETTERGB (255,160,122)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1247 {"orange" , PALETTERGB (255,165, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1248 {"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
1249 {"DarkOrange" , PALETTERGB (255,140, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1250 {"coral" , PALETTERGB (255,127, 80)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1251 {"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
1252 {"LightCoral" , PALETTERGB (240,128,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1253 {"tomato" , PALETTERGB (255, 99, 71)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1254 {"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
1255 {"OrangeRed" , PALETTERGB (255, 69, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1256 {"red" , PALETTERGB (255, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1257 {"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
1258 {"HotPink" , PALETTERGB (255,105,180)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1259 {"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
1260 {"DeepPink" , PALETTERGB (255, 20,147)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1261 {"pink" , PALETTERGB (255,192,203)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1262 {"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
1263 {"LightPink" , PALETTERGB (255,182,193)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1264 {"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
1265 {"PaleVioletRed" , PALETTERGB (219,112,147)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1266 {"maroon" , PALETTERGB (176, 48, 96)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1267 {"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
1268 {"MediumVioletRed" , PALETTERGB (199, 21,133)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1269 {"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
1270 {"VioletRed" , PALETTERGB (208, 32,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1271 {"magenta" , PALETTERGB (255, 0,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1272 {"violet" , PALETTERGB (238,130,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1273 {"plum" , PALETTERGB (221,160,221)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1274 {"orchid" , PALETTERGB (218,112,214)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1275 {"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
1276 {"MediumOrchid" , PALETTERGB (186, 85,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1277 {"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
1278 {"DarkOrchid" , PALETTERGB (153, 50,204)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1279 {"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
1280 {"DarkViolet" , PALETTERGB (148, 0,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1281 {"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
1282 {"BlueViolet" , PALETTERGB (138, 43,226)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1283 {"purple" , PALETTERGB (160, 32,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1284 {"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
1285 {"MediumPurple" , PALETTERGB (147,112,219)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1286 {"thistle" , PALETTERGB (216,191,216)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1287 {"gray0" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1288 {"grey0" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1289 {"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
1290 {"DarkGrey" , PALETTERGB (169,169,169)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1291 {"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
1292 {"DarkGray" , PALETTERGB (169,169,169)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1293 {"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
1294 {"DarkBlue" , PALETTERGB ( 0, 0,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1295 {"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
1296 {"DarkCyan" , PALETTERGB ( 0,139,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1297 {"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
1298 {"DarkMagenta" , PALETTERGB (139, 0,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1299 {"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
1300 {"DarkRed" , PALETTERGB (139, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1301 {"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
1302 {"LightGreen" , PALETTERGB (144,238,144)},
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1303 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1304
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1305 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
1306 0, 0, 0, "Return the default color map.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1307 ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1308 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1309 int i;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1310 colormap_t *pc = w32_color_map;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1311 Lisp_Object cmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1312
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1313 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1314
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1315 cmap = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1316
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1317 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
1318 pc++, i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1319 cmap = Fcons (Fcons (build_string (pc->name),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1320 make_number (pc->colorref)),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1321 cmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1322
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1323 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1324
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1325 return (cmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1326 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1327
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1328 Lisp_Object
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1329 w32_to_x_color (rgb)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1330 Lisp_Object rgb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1331 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1332 Lisp_Object color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1333
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1334 CHECK_NUMBER (rgb, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1335
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1336 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1337
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1338 color = Frassq (rgb, Vw32_color_map);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1339
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1340 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1341
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1342 if (!NILP (color))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1343 return (Fcar (color));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1344 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1345 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1346 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1347
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1348 COLORREF
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1349 w32_color_map_lookup (colorname)
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1350 char *colorname;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1351 {
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1352 Lisp_Object tail, ret = Qnil;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1353
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1354 BLOCK_INPUT;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1355
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1356 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
1357 {
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1358 register Lisp_Object elt, tem;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1359
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1360 elt = Fcar (tail);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1361 if (!CONSP (elt)) continue;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1362
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1363 tem = Fcar (elt);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1364
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1365 if (lstrcmpi (XSTRING (tem)->data, colorname) == 0)
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1366 {
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1367 ret = XUINT (Fcdr (elt));
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1368 break;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1369 }
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1370
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1371 QUIT;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1372 }
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1373
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1374
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1375 UNBLOCK_INPUT;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1376
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1377 return ret;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1378 }
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1379
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1380 COLORREF
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1381 x_to_w32_color (colorname)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1382 char * colorname;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1383 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1384 register Lisp_Object tail, ret = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1385
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1386 BLOCK_INPUT;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1387
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1388 if (colorname[0] == '#')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1389 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1390 /* 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
1391 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1392 int size;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1393 color = colorname + 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1394
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1395 size = strlen(color);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1396 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
1397 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1398 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1399 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1400 pos = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1401 size /= 3;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1402 colorval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1403
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1404 for (i = 0; i < 3; i++)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1405 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1406 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1407 char t;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1408 unsigned long value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1409
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1410 /* 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
1411 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
1412 our numbers, and we don't. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1413 if (!isxdigit(color[0]) || color[1] == 'x')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1414 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1415 t = color[size];
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1416 color[size] = '\0';
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1417 value = strtoul(color, &end, 16);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1418 color[size] = t;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1419 if (errno == ERANGE || end - color != size)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1420 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1421 switch (size)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1422 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1423 case 1:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1424 value = value * 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1425 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1426 case 2:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1427 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1428 case 3:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1429 value /= 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1430 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1431 case 4:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1432 value /= 0x100;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1433 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1434 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1435 colorval |= (value << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1436 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1437 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1438 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1439 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1440 return (colorval);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1441 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1442 color = end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1443 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1444 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1445 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1446 else if (strnicmp(colorname, "rgb:", 4) == 0)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1447 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1448 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1449 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1450 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1451 pos = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1452
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1453 colorval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1454 color = colorname + 4;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1455 for (i = 0; i < 3; i++)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1456 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1457 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1458 unsigned long value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1459
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1460 /* 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
1461 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
1462 our numbers, and we don't. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1463 if (!isxdigit(color[0]) || color[1] == 'x')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1464 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1465 value = strtoul(color, &end, 16);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1466 if (errno == ERANGE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1467 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1468 switch (end - color)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1469 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1470 case 1:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1471 value = value * 0x10 + value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1472 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1473 case 2:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1474 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1475 case 3:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1476 value /= 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1477 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1478 case 4:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1479 value /= 0x100;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1480 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1481 default:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1482 value = ULONG_MAX;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1483 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1484 if (value == ULONG_MAX)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1485 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1486 colorval |= (value << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1487 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1488 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1489 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1490 if (*end != '\0')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1491 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1492 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1493 return (colorval);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1494 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1495 if (*end != '/')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1496 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1497 color = end + 1;
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 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1500 else if (strnicmp(colorname, "rgbi:", 5) == 0)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1501 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1502 /* This is an RGB Intensity specification. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1503 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1504 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1505 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1506 pos = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1507
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1508 colorval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1509 color = colorname + 5;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1510 for (i = 0; i < 3; i++)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1511 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1512 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1513 double value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1514 UINT val;
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 value = strtod(color, &end);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1517 if (errno == ERANGE)
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 if (value < 0.0 || value > 1.0)
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 val = (UINT)(0x100 * value);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1522 /* 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
1523 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
1524 fixes the 1.0 case. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1525 if (val == 0x100)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1526 val = 0xFF;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1527 colorval |= (val << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1528 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1529 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1530 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1531 if (*end != '\0')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1532 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1533 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1534 return (colorval);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1535 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1536 if (*end != '/')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1537 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1538 color = end + 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1539 }
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 /* 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
1542 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
1543 RGB. */
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1544
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1545 /* 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
1546 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
1547 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
1548 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
1549 ret = w32_color_map_lookup (colorname);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1550 if (NILP (ret))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1551 {
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1552 int len = strlen (colorname);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1553
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1554 if (isdigit (colorname[len - 1]))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1555 {
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1556 char *ptr, *approx = alloca (len);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1557
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1558 strcpy (approx, colorname);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1559 ptr = &approx[len - 1];
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1560 while (ptr > approx && isdigit (*ptr))
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1561 *ptr-- = '\0';
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1562
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1563 ret = w32_color_map_lookup (approx);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1564 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1565 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1566
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1567 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1568 return ret;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1569 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1570
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1571
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1572 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1573 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
1574 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1575 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
1576 LOGPALETTE * log_palette;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1577 HPALETTE new_palette;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1578 int i;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1579
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1580 /* 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
1581 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
1582 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1583
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1584 log_palette = (LOGPALETTE *)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1585 alloca (sizeof (LOGPALETTE) +
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1586 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
1587 log_palette->palVersion = 0x300;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1588 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
1589
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1590 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
1591 for (i = 0;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1592 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
1593 i++, list = list->next)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1594 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
1595
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1596 new_palette = CreatePalette (log_palette);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1597
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1598 enter_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1599
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1600 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
1601 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
1602 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
1603
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1604 /* 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
1605 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
1606
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1607 leave_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1608 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1609
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1610 #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
1611 #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
1612 do \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1613 { \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1614 pe.peRed = GetRValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1615 pe.peGreen = GetGValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1616 pe.peBlue = GetBValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1617 pe.peFlags = 0; \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1618 } while (0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1619
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1620 #if 0
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1621 /* 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
1622 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1623 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
1624 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1625 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
1626
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1627 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
1628 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1629
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1630 /* 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
1631 while (list)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1632 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1633 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
1634 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1635 ++list->refcount;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1636 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1637 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1638 list = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1639 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1640
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1641 /* 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
1642 list = (struct w32_palette_entry *)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1643 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
1644 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
1645 list->refcount = 1;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1646 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
1647 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
1648 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
1649
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1650 /* 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
1651 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
1652 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1653
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1654 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1655 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
1656 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1657 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
1658 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
1659
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1660 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
1661 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1662
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1663 /* 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
1664 while (list)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1665 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1666 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
1667 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1668 if (--list->refcount == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1669 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1670 *prev = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1671 xfree (list);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1672 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
1673 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1674 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1675 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1676 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1677 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1678 prev = &list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1679 list = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1680 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1681
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1682 /* 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
1683 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
1684 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1685 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1686
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1687 /* Decide if color named COLOR is valid for the display associated with
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1688 the selected frame; if so, return the rgb values in COLOR_DEF.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1689 If ALLOC is nonzero, allocate a new colormap cell. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1690
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1691 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1692 defined_color (f, color, color_def, alloc)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1693 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1694 char *color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1695 COLORREF *color_def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1696 int alloc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1697 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1698 register Lisp_Object tem;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1699
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1700 tem = x_to_w32_color (color);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1701
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1702 if (!NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1703 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1704 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
1705 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1706 struct w32_palette_entry * entry =
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1707 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
1708 struct w32_palette_entry ** prev =
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1709 &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
1710
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1711 /* 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
1712 while (entry)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1713 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1714 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
1715 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1716 prev = &entry->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1717 entry = entry->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1718 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1719
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1720 if (entry == NULL && alloc)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1721 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1722 /* 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
1723 entry = (struct w32_palette_entry *)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1724 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
1725 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
1726 entry->next = NULL;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1727 *prev = entry;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1728 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
1729
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1730 /* 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
1731 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
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 /* 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
1735 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
1736 or not the display device has a palette. */
15034
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
1737 *color_def = XUINT (tem) | 0x2000000;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1738 return 1;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1739 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1740 else
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1741 {
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1742 return 0;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1743 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1744 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1745
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1746 /* 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
1747 suitable for screen F.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1748 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
1749 ARG says. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1750
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1751 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1752 x_decode_color (f, arg, def)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1753 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1754 Lisp_Object arg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1755 int def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1756 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1757 COLORREF cdef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1758
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1759 CHECK_STRING (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1760
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1761 if (strcmp (XSTRING (arg)->data, "black") == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1762 return BLACK_PIX_DEFAULT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1763 else if (strcmp (XSTRING (arg)->data, "white") == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1764 return WHITE_PIX_DEFAULT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1765
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1766 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
1767 return def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1768
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1769 /* defined_color is responsible for coping with failures
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1770 by looking for a near-miss. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1771 if (defined_color (f, XSTRING (arg)->data, &cdef, 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1772 return cdef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1773
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1774 /* defined_color failed; return an ultimate default. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1775 return def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1776 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1777
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1778 /* Functions called only from `x_set_frame_param'
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1779 to set individual parameters.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1780
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1781 If FRAME_W32_WINDOW (f) is 0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1782 the frame is being created and its window does not exist yet.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1783 In that case, just record the parameter's new value
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1784 in the standard place; do not attempt to change the window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1785
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1786 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1787 x_set_foreground_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1788 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1789 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1790 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1791 f->output_data.w32->foreground_pixel
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1792 = 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
1793
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1794 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1795 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1796 recompute_basic_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1797 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1798 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1799 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1800 }
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 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1803 x_set_background_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1804 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1805 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1806 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1807 Pixmap temp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1808 int mask;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1809
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1810 f->output_data.w32->background_pixel
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1811 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1812
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1813 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1814 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1815 SetWindowLong (FRAME_W32_WINDOW (f), WND_BACKGROUND_INDEX, f->output_data.w32->background_pixel);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1816
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1817 recompute_basic_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1818
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1819 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1820 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1821 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1822 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1823
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1824 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1825 x_set_mouse_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1826 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1827 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1828 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1829 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1830 Cursor cursor, nontext_cursor, mode_cursor, cross_cursor;
17669
607e8ef61ed0 (x_set_mouse_color): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 17632
diff changeset
1831 #endif
17632
d2915156a803 (x_set_mouse_color): Update calls to x_catch_errors
Richard M. Stallman <rms@gnu.org>
parents: 16884
diff changeset
1832 int count;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1833 int mask_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1834
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1835 if (!EQ (Qnil, arg))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1836 f->output_data.w32->mouse_pixel
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1837 = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1838 mask_color = f->output_data.w32->background_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1839 /* No invisible pointers. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1840 if (mask_color == f->output_data.w32->mouse_pixel
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1841 && mask_color == f->output_data.w32->background_pixel)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1842 f->output_data.w32->mouse_pixel = f->output_data.w32->foreground_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1843
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1844 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1845 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1846
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1847 /* 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
1848 count = x_catch_errors (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1849
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1850 if (!EQ (Qnil, Vx_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1851 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1852 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
1853 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XINT (Vx_pointer_shape));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1854 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1855 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1856 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
1857 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
1858
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1859 if (!EQ (Qnil, Vx_nontext_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1860 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1861 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
1862 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1863 XINT (Vx_nontext_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1864 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1865 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1866 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
1867 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
1868
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1869 if (!EQ (Qnil, Vx_mode_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1870 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1871 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
1872 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1873 XINT (Vx_mode_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1874 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1875 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1876 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
1877 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
1878
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1879 if (!EQ (Qnil, Vx_sensitive_text_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1880 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1881 CHECK_NUMBER (Vx_sensitive_text_pointer_shape, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1882 cross_cursor
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1883 = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1884 XINT (Vx_sensitive_text_pointer_shape));
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 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1887 cross_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_crosshair);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1888
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1889 /* 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
1890 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
1891 x_uncatch_errors (FRAME_W32_DISPLAY (f), count);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1892
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1893 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1894 XColor fore_color, back_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1895
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1896 fore_color.pixel = f->output_data.w32->mouse_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1897 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
1898 XQueryColor (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1899 DefaultColormap (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1900 DefaultScreen (FRAME_W32_DISPLAY (f))),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1901 &fore_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1902 XQueryColor (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1903 DefaultColormap (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1904 DefaultScreen (FRAME_W32_DISPLAY (f))),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1905 &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1906 XRecolorCursor (FRAME_W32_DISPLAY (f), cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1907 &fore_color, &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1908 XRecolorCursor (FRAME_W32_DISPLAY (f), nontext_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1909 &fore_color, &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1910 XRecolorCursor (FRAME_W32_DISPLAY (f), mode_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1911 &fore_color, &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1912 XRecolorCursor (FRAME_W32_DISPLAY (f), cross_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1913 &fore_color, &back_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1914 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1915
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1916 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1917 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1918 XDefineCursor (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), cursor);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1919 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1920
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1921 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
1922 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
1923 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
1924
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1925 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
1926 && 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
1927 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
1928 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
1929
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1930 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
1931 && 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
1932 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
1933 f->output_data.w32->modeline_cursor = mode_cursor;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1934 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
1935 && 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
1936 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
1937 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
1938
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1939 XFlush (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1940 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1941 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1942 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1943
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1944 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1945 x_set_cursor_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1946 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1947 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1948 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1949 unsigned long fore_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1950
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1951 if (!EQ (Vx_cursor_fore_pixel, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1952 fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1953 WHITE_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1954 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1955 fore_pixel = f->output_data.w32->background_pixel;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1956 f->output_data.w32->cursor_pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1957
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1958 /* Make sure that the cursor color differs from the background color. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1959 if (f->output_data.w32->cursor_pixel == f->output_data.w32->background_pixel)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1960 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1961 f->output_data.w32->cursor_pixel = f->output_data.w32->mouse_pixel;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1962 if (f->output_data.w32->cursor_pixel == fore_pixel)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1963 fore_pixel = f->output_data.w32->background_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1964 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1965 f->output_data.w32->cursor_foreground_pixel = fore_pixel;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1966
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1967 if (FRAME_W32_WINDOW (f) != 0)
13434
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 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1970 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1971 x_display_cursor (f, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1972 x_display_cursor (f, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1973 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1974 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1975 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1976
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1977 /* 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
1978 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
1979 F has an window. */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1980 void
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1981 x_set_border_pixel (f, pix)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1982 struct frame *f;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1983 int pix;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1984 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1985 f->output_data.w32->border_pixel = pix;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1986
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1987 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
1988 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1989 if (FRAME_VISIBLE_P (f))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1990 redraw_frame (f);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1991 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1992 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1993
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1994 /* Set the border-color of frame F to value described by ARG.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1995 ARG can be a string naming a color.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1996 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
1997 Note that this does not fully take effect if done before
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1998 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
1999
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2000 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2001 x_set_border_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2002 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2003 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2004 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2005 unsigned char *str;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2006 int pix;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2007
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2008 CHECK_STRING (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2009 str = XSTRING (arg)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2010
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2011 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2012
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2013 x_set_border_pixel (f, pix);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2016 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2017 x_set_cursor_type (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2018 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2019 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2020 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2021 if (EQ (arg, Qbar))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2022 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2023 FRAME_DESIRED_CURSOR (f) = bar_cursor;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2024 f->output_data.w32->cursor_width = 2;
13434
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 else if (CONSP (arg) && EQ (XCONS (arg)->car, Qbar)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2027 && INTEGERP (XCONS (arg)->cdr))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2028 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2029 FRAME_DESIRED_CURSOR (f) = bar_cursor;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2030 f->output_data.w32->cursor_width = XINT (XCONS (arg)->cdr);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2031 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2032 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2033 /* Treat anything unknown as "box cursor".
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2034 It was bad to signal an error; people have trouble fixing
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2035 .Xdefaults with Emacs, when it has something bad in it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2036 FRAME_DESIRED_CURSOR (f) = filled_box_cursor;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2037
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2038 /* Make sure the cursor gets redrawn. This is overkill, but how
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2039 often do people change cursor types? */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2040 update_mode_lines++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2041 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2042
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2043 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2044 x_set_icon_type (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2045 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2046 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2047 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2048 int result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2049
25235
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2050 if (NILP (arg) && NILP (oldval))
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2051 return;
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2052
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2053 if (STRINGP (arg) && STRINGP (oldval)
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2054 && 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
2055 return;
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2056
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2057 if (SYMBOLP (arg) && SYMBOLP (oldval) && EQ (arg, oldval))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2058 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2059
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2060 BLOCK_INPUT;
25235
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2061
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
2062 result = x_bitmap_icon (f, arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2063 if (result)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2064 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2065 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2066 error ("No icon window available");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2067 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2068
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2069 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2070 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2071
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2072 /* Return non-nil if frame F wants a bitmap icon. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2073
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2074 Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2075 x_icon_type (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2076 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2077 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2078 Lisp_Object tem;
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 tem = assq_no_quit (Qicon_type, f->param_alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2081 if (CONSP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2082 return XCONS (tem)->cdr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2083 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2084 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2085 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2086
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2087 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2088 x_set_icon_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2089 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2090 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2091 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2092 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2093 int result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2094
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2095 if (STRINGP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2096 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2097 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2098 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2099 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2100 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2101 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2102
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2103 f->icon_name = arg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2104
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2105 #if 0
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2106 if (f->output_data.w32->icon_bitmap != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2107 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2108
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2109 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2110
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2111 result = x_text_icon (f,
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2112 (char *) XSTRING ((!NILP (f->icon_name)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2113 ? f->icon_name
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2114 : !NILP (f->title)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2115 ? f->title
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2116 : f->name))->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2117
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2118 if (result)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2119 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2120 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2121 error ("No icon window available");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2122 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2123
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2124 /* If the window was unmapped (and its icon was mapped),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2125 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
2126 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2127 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2128 #ifdef USE_X_TOOLKIT
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2129 XtPopup (f->output_data.w32->widget, XtGrabNone);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2130 #endif
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2131 XMapWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2132 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2133
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2134 XFlush (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2135 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2136 #endif
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2139 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
2140 extern Lisp_Object x_new_fontset();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2141
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_font (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 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2147 Lisp_Object result;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2148 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
2149 Lisp_Object frame;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2150
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2151 CHECK_STRING (arg, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2152
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2153 fontset_name = Fquery_fontset (arg, Qnil);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2154
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2155 BLOCK_INPUT;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2156 result = (STRINGP (fontset_name)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2157 ? 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
2158 : x_new_font (f, XSTRING (arg)->data));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2159 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2160
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2161 if (EQ (result, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2162 error ("Font \"%s\" is not defined", XSTRING (arg)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2163 else if (EQ (result, Qt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2164 error ("the characters of the given font have varying widths");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2165 else if (STRINGP (result))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2166 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2167 recompute_basic_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2168 store_frame_param (f, Qfont, result);
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 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2171 abort ();
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
2172
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
2173 XSETFRAME (frame, f);
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
2174 call1 (Qface_set_after_frame_default, frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2175 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2176
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2177 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2178 x_set_border_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2179 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2180 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2181 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2182 CHECK_NUMBER (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2183
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2184 if (XINT (arg) == f->output_data.w32->border_width)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2185 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2186
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2187 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2188 error ("Cannot change the border width of a window");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2189
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2190 f->output_data.w32->border_width = XINT (arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2191 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2192
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2193 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2194 x_set_internal_border_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2195 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2196 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2197 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2198 int mask;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2199 int old = f->output_data.w32->internal_border_width;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2200
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2201 CHECK_NUMBER (arg, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2202 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
2203 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
2204 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
2205
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2206 if (f->output_data.w32->internal_border_width == old)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2207 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2208
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2209 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2210 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2211 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2212 x_set_window_size (f, 0, f->width, f->height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2213 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2214 SET_FRAME_GARBAGED (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2215 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2216 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2217
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2218 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2219 x_set_visibility (f, value, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2220 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2221 Lisp_Object value, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2222 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2223 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2224 XSETFRAME (frame, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2225
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2226 if (NILP (value))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2227 Fmake_frame_invisible (frame, Qt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2228 else if (EQ (value, Qicon))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2229 Ficonify_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2230 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2231 Fmake_frame_visible (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2232 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2233
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2234 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2235 x_set_menu_bar_lines (f, value, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2236 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2237 Lisp_Object value, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2238 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2239 int nlines;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2240 int olines = FRAME_MENU_BAR_LINES (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2241
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2242 /* Right now, menu bars don't work properly in minibuf-only frames;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2243 most of the commands try to apply themselves to the minibuffer
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2244 frame itslef, and get an error because you can't switch buffers
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2245 in or split the minibuffer window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2246 if (FRAME_MINIBUF_ONLY_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2247 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2248
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2249 if (INTEGERP (value))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2250 nlines = XINT (value);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2251 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2252 nlines = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2253
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2254 FRAME_MENU_BAR_LINES (f) = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2255 if (nlines)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2256 FRAME_EXTERNAL_MENU_BAR (f) = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2257 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2258 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2259 if (FRAME_EXTERNAL_MENU_BAR (f) == 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2260 free_frame_menubar (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2261 FRAME_EXTERNAL_MENU_BAR (f) = 0;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2262
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2263 /* 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
2264 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
2265 set correctly. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2266 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2267 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2268 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2269
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2270 /* 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
2271 w32_id_name.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2272
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2273 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
2274 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
2275 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2276
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2277 If EXPLICIT is zero, that indicates that Emacs redisplay code is
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2278 suggesting a new name, which lisp code should override; if
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2279 F->explicit_name is set, ignore the new name; otherwise, set it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2280
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2281 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2282 x_set_name (f, name, explicit)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2283 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2284 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2285 int explicit;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2286 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2287 /* Make sure that requests from lisp code override requests from
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2288 Emacs redisplay code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2289 if (explicit)
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 /* If we're switching from explicit to implicit, we had better
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2292 update the mode lines and thereby update the title. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2293 if (f->explicit_name && NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2294 update_mode_lines = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2295
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2296 f->explicit_name = ! NILP (name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2297 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2298 else if (f->explicit_name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2299 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2300
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2301 /* 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
2302 if (NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2303 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2304 /* Check for no change needed in this very common case
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2305 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
2306 if (!strcmp (FRAME_W32_DISPLAY_INFO (f)->w32_id_name,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2307 XSTRING (f->name)->data))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2308 return;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2309 name = build_string (FRAME_W32_DISPLAY_INFO (f)->w32_id_name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2310 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2311 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2312 CHECK_STRING (name, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2313
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2314 /* Don't change the name if it's already NAME. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2315 if (! NILP (Fstring_equal (name, f->name)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2316 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2317
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2318 f->name = name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2319
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2320 /* 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
2321 the name parameter. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2322 if (! NILP (f->title))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2323 name = f->title;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2324
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2325 if (FRAME_W32_WINDOW (f))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2326 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2327 BLOCK_INPUT;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2328 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2329 UNBLOCK_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 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2332
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2333 /* This function should be called when the user's lisp code has
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2334 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
2335 redisplay code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2336 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2337 x_explicitly_set_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2338 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2339 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2340 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2341 x_set_name (f, arg, 1);
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 /* This function should be called by Emacs redisplay code to set the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2345 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
2346 lisp code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2347 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2348 x_implicitly_set_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2349 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2350 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2351 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2352 x_set_name (f, arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2353 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2354
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2355 /* 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
2356 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
2357
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2358 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
2359 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
2360 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
2361
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2362 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
2363 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
2364 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
2365
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2366 void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2367 x_set_title (f, name)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2368 struct frame *f;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2369 Lisp_Object name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2370 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2371 /* 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
2372 if (EQ (name, f->title))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2373 return;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2374
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2375 update_mode_lines = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2376
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2377 f->title = name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2378
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2379 if (NILP (name))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2380 name = f->name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2381
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2382 if (FRAME_W32_WINDOW (f))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2383 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2384 BLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2385 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
2386 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2387 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2388 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2389
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2390 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2391 x_set_autoraise (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2392 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2393 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2394 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2395 f->auto_raise = !EQ (Qnil, arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2396 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2397
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2398 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2399 x_set_autolower (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2400 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2401 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2402 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2403 f->auto_lower = !EQ (Qnil, arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2404 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2405
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2406 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2407 x_set_unsplittable (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2408 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2409 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2410 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2411 f->no_split = !NILP (arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2412 }
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 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2415 x_set_vertical_scroll_bars (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2416 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2417 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2418 {
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2419 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
2420 || (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
2421 || (NILP (arg) && FRAME_HAS_VERTICAL_SCROLL_BARS (f))
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2422 || (!NILP (arg) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f)))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2423 {
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2424 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = NILP (arg) ?
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2425 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
2426 /* 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
2427 on MS-Windows. */
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
2428 EQ (Qleft, arg)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
2429 ? 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
2430 : vertical_scroll_bar_right;
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 /* We set this parameter before creating the window for the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2433 frame, so we can get the geometry right from the start.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2434 However, if the window hasn't been created yet, we shouldn't
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2435 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
2436 if (FRAME_W32_WINDOW (f))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2437 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2438 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2439 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2440
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2441 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2442 x_set_scroll_bar_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2443 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2444 Lisp_Object arg, oldval;
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 if (NILP (arg))
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 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2449 FRAME_SCROLL_BAR_COLS (f) = 2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2450 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2451 else if (INTEGERP (arg) && XINT (arg) > 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2452 && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2453 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2454 int wid = FONT_WIDTH (f->output_data.w32->font);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2455 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2456 FRAME_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + wid-1) / wid;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2457 if (FRAME_W32_WINDOW (f))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2458 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2459 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2460 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2461
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2462 /* Subroutines of creating an frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2463
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2464 /* Make sure that Vx_resource_name is set to a reasonable value.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2465 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
2466
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2467 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2468 validate_x_resource_name ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2469 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2470 int len;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2471 /* Number of valid characters in the resource name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2472 int good_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2473 /* Number of invalid characters in the resource name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2474 int bad_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2475 Lisp_Object new;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2476 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2477
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2478 if (STRINGP (Vx_resource_name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2479 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2480 unsigned char *p = XSTRING (Vx_resource_name)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2481 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2482
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2483 len = XSTRING (Vx_resource_name)->size;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2484
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2485 /* Only letters, digits, - and _ are valid in resource names.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2486 Count the valid characters and count the invalid ones. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2487 for (i = 0; i < len; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2488 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2489 int c = p[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2490 if (! ((c >= 'a' && c <= 'z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2491 || (c >= 'A' && c <= 'Z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2492 || (c >= '0' && c <= '9')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2493 || c == '-' || c == '_'))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2494 bad_count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2495 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2496 good_count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2497 }
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 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2500 /* Not a string => completely invalid. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2501 bad_count = 5, good_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2502
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2503 /* If name is valid already, return. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2504 if (bad_count == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2505 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2506
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2507 /* If name is entirely invalid, or nearly so, use `emacs'. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2508 if (good_count == 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2509 || (good_count == 1 && bad_count > 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2510 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2511 Vx_resource_name = build_string ("emacs");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2512 return;
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2515 /* Name is partly valid. Copy it and replace the invalid characters
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2516 with underscores. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2517
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2518 Vx_resource_name = new = Fcopy_sequence (Vx_resource_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2519
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2520 for (i = 0; i < len; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2521 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2522 int c = XSTRING (new)->data[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2523 if (! ((c >= 'a' && c <= 'z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2524 || (c >= 'A' && c <= 'Z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2525 || (c >= '0' && c <= '9')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2526 || c == '-' || c == '_'))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2527 XSTRING (new)->data[i] = '_';
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2528 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2529 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2530
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2531
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2532 extern char *x_get_string_resource ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2533
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2534 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
2535 "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
2536 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
2537 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
2538 the name specified by the `-name' or `-rn' command-line arguments.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2539 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2540 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
2541 class, respectively. You must specify both of them or neither.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2542 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2543 and the class is `Emacs.CLASS.SUBCLASS'.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2544 (attribute, class, component, subclass)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2545 Lisp_Object attribute, class, component, subclass;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2546 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2547 register char *value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2548 char *name_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2549 char *class_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2550
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2551 CHECK_STRING (attribute, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2552 CHECK_STRING (class, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2553
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2554 if (!NILP (component))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2555 CHECK_STRING (component, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2556 if (!NILP (subclass))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2557 CHECK_STRING (subclass, 2);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2558 if (NILP (component) != NILP (subclass))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2559 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2560
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2561 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2562
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2563 /* Allocate space for the components, the dots which separate them,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2564 and the final '\0'. Make them big enough for the worst case. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2565 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2566 + (STRINGP (component)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2567 ? XSTRING (component)->size : 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2568 + XSTRING (attribute)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2569 + 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2570
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2571 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2572 + XSTRING (class)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2573 + (STRINGP (subclass)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2574 ? XSTRING (subclass)->size : 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2575 + 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2576
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2577 /* Start with emacs.FRAMENAME for the name (the specific one)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2578 and with `Emacs' for the class key (the general one). */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2579 strcpy (name_key, XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2580 strcpy (class_key, EMACS_CLASS);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2581
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2582 strcat (class_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2583 strcat (class_key, XSTRING (class)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2584
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2585 if (!NILP (component))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2586 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2587 strcat (class_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2588 strcat (class_key, XSTRING (subclass)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2589
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2590 strcat (name_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2591 strcat (name_key, XSTRING (component)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2592 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2593
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2594 strcat (name_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2595 strcat (name_key, XSTRING (attribute)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2596
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2597 value = x_get_string_resource (Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2598 name_key, class_key);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2599
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2600 if (value != (char *) 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2601 return build_string (value);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2602 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2603 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2604 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2605
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2606 /* Used when C code wants a resource value. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2607
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2608 char *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2609 x_get_resource_string (attribute, class)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2610 char *attribute, *class;
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 register char *value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2613 char *name_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2614 char *class_key;
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 /* Allocate space for the components, the dots which separate them,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2617 and the final '\0'. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2618 name_key = (char *) alloca (XSTRING (Vinvocation_name)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2619 + strlen (attribute) + 2);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2620 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2621 + strlen (class) + 2);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2622
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2623 sprintf (name_key, "%s.%s",
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2624 XSTRING (Vinvocation_name)->data,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2625 attribute);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2626 sprintf (class_key, "%s.%s", EMACS_CLASS, class);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2627
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2628 return x_get_string_resource (selected_frame,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2629 name_key, class_key);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2630 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2631
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2632 /* Types we might convert a resource string into. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2633 enum resource_types
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 number, boolean, string, symbol
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2638 /* Return the value of parameter PARAM.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2639
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2640 First search ALIST, then Vdefault_frame_alist, then the X defaults
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2641 database, using ATTRIBUTE as the attribute name and CLASS as its class.
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 Convert the resource to the type specified by desired_type.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2644
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2645 If no default is specified, return Qunbound. If you call
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2646 x_get_arg, make sure you deal with Qunbound in a reasonable way,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2647 and don't let it get stored in any Lisp-visible variables! */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2648
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2649 static Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2650 x_get_arg (alist, param, attribute, class, type)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2651 Lisp_Object alist, param;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2652 char *attribute;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2653 char *class;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2654 enum resource_types type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2655 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2656 register Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2657
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2658 tem = Fassq (param, alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2659 if (EQ (tem, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2660 tem = Fassq (param, Vdefault_frame_alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2661 if (EQ (tem, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2662 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2663
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2664 if (attribute)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2665 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2666 tem = Fx_get_resource (build_string (attribute),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2667 build_string (class),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2668 Qnil, Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2669
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2670 if (NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2671 return Qunbound;
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 switch (type)
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 case number:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2676 return make_number (atoi (XSTRING (tem)->data));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2677
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2678 case boolean:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2679 tem = Fdowncase (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2680 if (!strcmp (XSTRING (tem)->data, "on")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2681 || !strcmp (XSTRING (tem)->data, "true"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2682 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2683 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2684 return Qnil;
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 case string:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2687 return tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2688
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2689 case symbol:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2690 /* As a special case, we map the values `true' and `on'
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2691 to Qt, and `false' and `off' to Qnil. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2692 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2693 Lisp_Object lower;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2694 lower = Fdowncase (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2695 if (!strcmp (XSTRING (lower)->data, "on")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2696 || !strcmp (XSTRING (lower)->data, "true"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2697 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2698 else if (!strcmp (XSTRING (lower)->data, "off")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2699 || !strcmp (XSTRING (lower)->data, "false"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2700 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2701 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2702 return Fintern (tem, Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2703 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2704
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2705 default:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2706 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2707 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2708 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2709 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2710 return Qunbound;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2711 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2712 return Fcdr (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2713 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2714
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2715 /* Record in frame F the specified or default value according to ALIST
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2716 of the parameter named PARAM (a Lisp symbol).
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2717 If no value is specified for PARAM, look for an X default for XPROP
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2718 on the frame named NAME.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2719 If that is not found either, use the value DEFLT. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2720
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2721 static Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2722 x_default_parameter (f, alist, prop, deflt, xprop, xclass, type)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2723 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2724 Lisp_Object alist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2725 Lisp_Object prop;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2726 Lisp_Object deflt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2727 char *xprop;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2728 char *xclass;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2729 enum resource_types type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2730 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2731 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2732
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2733 tem = x_get_arg (alist, prop, xprop, xclass, type);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2734 if (EQ (tem, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2735 tem = deflt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2736 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2737 return tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2738 }
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 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
2741 "Parse an X-style geometry string STRING.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2742 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2743 The properties returned may include `top', `left', `height', and `width'.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2744 The value of `left' or `top' may be an integer,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2745 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
2746 or a list (- N) meaning -N pixels relative to bottom/right corner.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2747 (string)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2748 Lisp_Object string;
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 int geometry, x, y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2751 unsigned int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2752 Lisp_Object result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2753
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2754 CHECK_STRING (string, 0);
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 geometry = XParseGeometry ((char *) XSTRING (string)->data,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2757 &x, &y, &width, &height);
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 result = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2760 if (geometry & XValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2761 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2762 Lisp_Object element;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2763
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2764 if (x >= 0 && (geometry & XNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2765 element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2766 else if (x < 0 && ! (geometry & XNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2767 element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2768 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2769 element = Fcons (Qleft, make_number (x));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2770 result = Fcons (element, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2771 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2772
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2773 if (geometry & YValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2774 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2775 Lisp_Object element;
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 if (y >= 0 && (geometry & YNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2778 element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2779 else if (y < 0 && ! (geometry & YNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2780 element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2781 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2782 element = Fcons (Qtop, make_number (y));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2783 result = Fcons (element, result);
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 if (geometry & WidthValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2787 result = Fcons (Fcons (Qwidth, make_number (width)), result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2788 if (geometry & HeightValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2789 result = Fcons (Fcons (Qheight, make_number (height)), result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2790
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2791 return result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2792 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2793
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2794 /* Calculate the desired size and position of this window,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2795 and return the flags saying which aspects were specified.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2796
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2797 This function does not make the coordinates positive. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2798
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2799 #define DEFAULT_ROWS 40
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2800 #define DEFAULT_COLS 80
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2801
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2802 static int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2803 x_figure_window_size (f, parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2804 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2805 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2806 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2807 register Lisp_Object tem0, tem1, tem2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2808 int height, width, left, top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2809 register int geometry;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2810 long window_prompting = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2811
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2812 /* Default values if we fall through.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2813 Actually, if that happens we should get
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2814 window manager prompting. */
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2815 SET_FRAME_WIDTH (f, DEFAULT_COLS);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2816 f->height = DEFAULT_ROWS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2817 /* Window managers expect that if program-specified
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2818 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
2819 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
2820 f->output_data.w32->left_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2821
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2822 tem0 = x_get_arg (parms, Qheight, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2823 tem1 = x_get_arg (parms, Qwidth, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2824 tem2 = x_get_arg (parms, Quser_size, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2825 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2826 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2827 if (!EQ (tem0, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2828 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2829 CHECK_NUMBER (tem0, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2830 f->height = XINT (tem0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2831 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2832 if (!EQ (tem1, Qunbound))
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 CHECK_NUMBER (tem1, 0);
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2835 SET_FRAME_WIDTH (f, XINT (tem1));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2836 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2837 if (!NILP (tem2) && !EQ (tem2, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2838 window_prompting |= USSize;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2839 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2840 window_prompting |= PSize;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2841 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2842
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2843 f->output_data.w32->vertical_scroll_bar_extra
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2844 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2845 ? 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2846 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2847 ? 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
2848 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font)));
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2849 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
2850 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
2851
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2852 tem0 = x_get_arg (parms, Qtop, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2853 tem1 = x_get_arg (parms, Qleft, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2854 tem2 = x_get_arg (parms, Quser_position, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2855 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2856 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2857 if (EQ (tem0, Qminus))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2858 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2859 f->output_data.w32->top_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2860 window_prompting |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2861 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2862 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2863 && CONSP (XCONS (tem0)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2864 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2865 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2866 f->output_data.w32->top_pos = - XINT (XCONS (XCONS (tem0)->cdr)->car);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2867 window_prompting |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2868 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2869 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2870 && CONSP (XCONS (tem0)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2871 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2872 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2873 f->output_data.w32->top_pos = XINT (XCONS (XCONS (tem0)->cdr)->car);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2874 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2875 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
2876 f->output_data.w32->top_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2877 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2878 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2879 CHECK_NUMBER (tem0, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2880 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
2881 if (f->output_data.w32->top_pos < 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2882 window_prompting |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2883 }
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 if (EQ (tem1, Qminus))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2886 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2887 f->output_data.w32->left_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2888 window_prompting |= XNegative;
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 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2891 && CONSP (XCONS (tem1)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2892 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2893 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2894 f->output_data.w32->left_pos = - XINT (XCONS (XCONS (tem1)->cdr)->car);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2895 window_prompting |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2896 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2897 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2898 && CONSP (XCONS (tem1)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2899 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2900 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2901 f->output_data.w32->left_pos = XINT (XCONS (XCONS (tem1)->cdr)->car);
13434
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 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
2904 f->output_data.w32->left_pos = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2905 else
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_NUMBER (tem1, 0);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2908 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
2909 if (f->output_data.w32->left_pos < 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2910 window_prompting |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2911 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2912
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2913 if (!NILP (tem2) && ! EQ (tem2, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2914 window_prompting |= USPosition;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2915 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2916 window_prompting |= PPosition;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2917 }
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 return window_prompting;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2920 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2921
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2922
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2923
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2924 extern LRESULT CALLBACK w32_wnd_proc ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2925
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2926 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2927 w32_init_class (hinst)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2928 HINSTANCE hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2929 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2930 WNDCLASS wc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2931
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2932 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
2933 wc.lpfnWndProc = (WNDPROC) w32_wnd_proc;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2934 wc.cbClsExtra = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2935 wc.cbWndExtra = WND_EXTRA_BYTES;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2936 wc.hInstance = hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2937 wc.hIcon = LoadIcon (hinst, EMACS_CLASS);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2938 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
2939 wc.hbrBackground = NULL; /* GetStockObject (WHITE_BRUSH); */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2940 wc.lpszMenuName = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2941 wc.lpszClassName = EMACS_CLASS;
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 return (RegisterClass (&wc));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2944 }
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 HWND
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2947 w32_createscrollbar (f, bar)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2948 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2949 struct scroll_bar * bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2950 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2951 return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2952 /* Position and size of scroll bar. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2953 XINT(bar->left), XINT(bar->top),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2954 XINT(bar->width), XINT(bar->height),
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2955 FRAME_W32_WINDOW (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2956 NULL,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2957 hinst,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2958 NULL));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2959 }
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 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2962 w32_createwindow (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2963 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2964 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2965 HWND hwnd;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2966 RECT rect;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2967
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2968 rect.left = rect.top = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2969 rect.right = PIXEL_WIDTH (f);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2970 rect.bottom = PIXEL_HEIGHT (f);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2971
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2972 AdjustWindowRect (&rect, f->output_data.w32->dwStyle,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2973 FRAME_EXTERNAL_MENU_BAR (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2974
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2975 /* Do first time app init */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2976
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2977 if (!hprevinst)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2978 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2979 w32_init_class (hinst);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2980 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2981
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2982 FRAME_W32_WINDOW (f) = hwnd
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2983 = CreateWindow (EMACS_CLASS,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2984 f->namebuf,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2985 f->output_data.w32->dwStyle | WS_CLIPCHILDREN,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2986 f->output_data.w32->left_pos,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2987 f->output_data.w32->top_pos,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2988 rect.right - rect.left,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2989 rect.bottom - rect.top,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2990 NULL,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2991 NULL,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2992 hinst,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2993 NULL);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2994
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2995 if (hwnd)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2996 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2997 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
2998 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
2999 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
3000 SetWindowLong (hwnd, WND_SCROLLBAR_INDEX, f->output_data.w32->vertical_scroll_bar_extra);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3001 SetWindowLong (hwnd, WND_BACKGROUND_INDEX, f->output_data.w32->background_pixel);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3002
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3003 /* Enable drag-n-drop. */
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3004 DragAcceptFiles (hwnd, TRUE);
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3005
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3006 /* 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
3007 ShowWindow (hwnd, SW_HIDE);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3008 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3009 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3010
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3011 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3012 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
3013 W32Msg * wmsg;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3014 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3015 UINT msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3016 WPARAM wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3017 LPARAM lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3018 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3019 wmsg->msg.hwnd = hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3020 wmsg->msg.message = msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3021 wmsg->msg.wParam = wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3022 wmsg->msg.lParam = lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3023 wmsg->msg.time = GetMessageTime ();
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 post_msg (wmsg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3026 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3027
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
3028 /* 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
3029 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
3030 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
3031 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
3032 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
3033 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
3034 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
3035 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
3036 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
3037 on Swedish keyboards). */
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3038
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3039 #define EMACS_LCONTROL 0
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3040 #define EMACS_RCONTROL 1
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3041 #define EMACS_LMENU 2
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3042 #define EMACS_RMENU 3
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3043
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3044 static int modifiers[4];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3045 static int modifiers_recorded;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3046 static int modifier_key_support_tested;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3047
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3048 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3049 test_modifier_support (unsigned int wparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3050 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3051 unsigned int l, r;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3052
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3053 if (wparam != VK_CONTROL && wparam != VK_MENU)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3054 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3055 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3056 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3057 l = VK_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3058 r = VK_RCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3059 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3060 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3061 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3062 l = VK_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3063 r = VK_RMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3064 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3065 if (!(GetKeyState (l) & 0x8000) && !(GetKeyState (r) & 0x8000))
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3066 modifiers_recorded = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3067 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3068 modifiers_recorded = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3069 modifier_key_support_tested = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3070 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3071
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3072 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3073 record_keydown (unsigned int wparam, unsigned int lparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3074 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3075 int i;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3076
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3077 if (!modifier_key_support_tested)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3078 test_modifier_support (wparam);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3079
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3080 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
3081 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3082
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3083 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3084 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3085 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3086 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3087
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3088 modifiers[i] = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3089 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3090
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3091 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3092 record_keyup (unsigned int wparam, unsigned int lparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3093 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3094 int i;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3095
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3096 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
3097 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3098
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3099 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3100 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3101 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3102 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3103
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3104 modifiers[i] = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3105 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3106
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3107 /* 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
3108 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
3109 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
3110 static void
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3111 reset_modifiers ()
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3112 {
15314
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3113 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
3114
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3115 if (GetFocus () == NULL)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3116 /* 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
3117 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
3118
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3119 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
3120 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
3121
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3122 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
3123 /* 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
3124 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
3125
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3126 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
3127 /* 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
3128 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
3129
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3130 /* 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
3131 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
3132 result of a hot-key being pressed. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3133 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3134 BYTE keystate[256];
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3135
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3136 #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
3137
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3138 GetKeyboardState (keystate);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3139 keystate[VK_SHIFT] = CURRENT_STATE (VK_SHIFT);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3140 keystate[VK_CONTROL] = CURRENT_STATE (VK_CONTROL);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3141 keystate[VK_LCONTROL] = CURRENT_STATE (VK_LCONTROL);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3142 keystate[VK_RCONTROL] = CURRENT_STATE (VK_RCONTROL);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3143 keystate[VK_MENU] = CURRENT_STATE (VK_MENU);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3144 keystate[VK_LMENU] = CURRENT_STATE (VK_LMENU);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3145 keystate[VK_RMENU] = CURRENT_STATE (VK_RMENU);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3146 keystate[VK_LWIN] = CURRENT_STATE (VK_LWIN);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3147 keystate[VK_RWIN] = CURRENT_STATE (VK_RWIN);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3148 keystate[VK_APPS] = CURRENT_STATE (VK_APPS);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3149 SetKeyboardState (keystate);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3150 }
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3151 }
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3152
15377
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3153 /* 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
3154 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
3155 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
3156 the left or right modifier should be set. */
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3157 static void
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3158 sync_modifiers ()
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3159 {
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3160 if (!modifiers_recorded)
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3161 return;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3162
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3163 if (!(GetKeyState (VK_CONTROL) & 0x8000))
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3164 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3165
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3166 if (!(GetKeyState (VK_MENU) & 0x8000))
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3167 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3168 }
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3169
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3170 static int
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3171 modifier_set (int vkey)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3172 {
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3173 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
3174 return (GetKeyState (vkey) & 0x1);
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3175 if (!modifiers_recorded)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3176 return (GetKeyState (vkey) & 0x8000);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3177
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3178 switch (vkey)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3179 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3180 case VK_LCONTROL:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3181 return modifiers[EMACS_LCONTROL];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3182 case VK_RCONTROL:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3183 return modifiers[EMACS_RCONTROL];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3184 case VK_LMENU:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3185 return modifiers[EMACS_LMENU];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3186 case VK_RMENU:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3187 return modifiers[EMACS_RMENU];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3188 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3189 return (GetKeyState (vkey) & 0x8000);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3190 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3191
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3192 /* 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
3193 Emacs uses. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3194
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3195 unsigned int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3196 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
3197 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3198 Lisp_Object key_mapping;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3199
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3200 switch (key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3201 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3202 case VK_LWIN:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3203 key_mapping = Vw32_lwindow_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3204 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3205 case VK_RWIN:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3206 key_mapping = Vw32_rwindow_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3207 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3208 case VK_APPS:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3209 key_mapping = Vw32_apps_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3210 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3211 case VK_SCROLL:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3212 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
3213 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3214 default:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3215 key_mapping = Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3216 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3217
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3218 /* 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
3219 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
3220 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
3221 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
3222 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
3223 markbits here. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3224 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
3225 return hyper_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3226 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
3227 return super_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3228 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
3229 return meta_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3230 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
3231 return alt_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3232 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
3233 return ctrl_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3234 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
3235 return ctrl_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3236 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
3237 return shift_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3238
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3239 /* 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
3240 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3241 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3242
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3243 unsigned int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3244 w32_get_modifiers ()
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3245 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3246 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
3247 (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
3248 (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
3249 (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
3250 (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
3251 (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
3252 (modifier_set (VK_MENU) ?
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3253 ((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
3254 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3255
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3256 /* 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
3257 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
3258 and window input. */
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3259
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3260 static int
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3261 construct_console_modifiers ()
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3262 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3263 int mods;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3264
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3265 mods = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3266 mods |= (modifier_set (VK_SHIFT)) ? SHIFT_PRESSED : 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3267 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
3268 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
3269 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
3270 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
3271 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
3272 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
3273 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
3274 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
3275 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
3276 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
3277
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3278 return mods;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3279 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3280
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3281 static int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3282 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
3283 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3284 int mods;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3285
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3286 /* Convert to emacs modifiers. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3287 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
3288
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3289 return mods;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3290 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3291
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3292 unsigned int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3293 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
3294 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3295 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
3296 return virt_key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3297
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3298 if (virt_key == VK_RETURN)
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3299 return (extended ? VK_NUMPAD_ENTER : VK_RETURN);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3300
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3301 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
3302 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
3303
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3304 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
3305 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
3306
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3307 if (virt_key == VK_CLEAR)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3308 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
3309
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3310 return virt_key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3311 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3312
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3313 /* 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
3314 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
3315 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
3316 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
3317 Lisp_Object w32_grabbed_keys;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3318
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3319 #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
3320 #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
3321 #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
3322 #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
3323
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3324 /* 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
3325 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
3326 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
3327
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3328 static void
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3329 register_hot_keys (hwnd)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3330 HWND hwnd;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3331 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3332 Lisp_Object keylist;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3333
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3334 /* 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
3335 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
3336 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3337 Lisp_Object key = XCAR (keylist);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3338
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3339 /* 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
3340 if (!INTEGERP (key))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3341 continue;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3342
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3343 RegisterHotKey (hwnd, HOTKEY_ID (key),
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3344 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
3345 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3346 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3347
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3348 static void
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3349 unregister_hot_keys (hwnd)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3350 HWND hwnd;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3351 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3352 Lisp_Object keylist;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3353
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3354 /* 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
3355 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
3356 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3357 Lisp_Object key = XCAR (keylist);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3358
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3359 if (!INTEGERP (key))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3360 continue;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3361
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3362 UnregisterHotKey (hwnd, HOTKEY_ID (key));
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3363 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3364 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3365
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3366 /* Main message dispatch loop. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3367
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3368 static void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3369 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
3370 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3371 MSG msg;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3372 int result;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3373 HWND focus_window;
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3374
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3375 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
3376
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3377 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
3378 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3379 if (msg.hwnd == NULL)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3380 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3381 switch (msg.message)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3382 {
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3383 case WM_NULL:
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3384 /* 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
3385 break;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3386 case WM_EMACS_CREATEWINDOW:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3387 w32_createwindow ((struct frame *) msg.wParam);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3388 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
3389 abort ();
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3390 break;
21608
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3391 case WM_EMACS_SETLOCALE:
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3392 SetThreadLocale (msg.wParam);
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3393 /* Reply is not expected. */
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3394 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3395 case WM_EMACS_SETKEYBOARDLAYOUT:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3396 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
3397 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
3398 result, 0))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3399 abort ();
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3400 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3401 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
3402 focus_window = GetFocus ();
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3403 if (focus_window != NULL)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3404 RegisterHotKey (focus_window,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3405 HOTKEY_ID (msg.wParam),
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3406 HOTKEY_MODIFIERS (msg.wParam),
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3407 HOTKEY_VK_CODE (msg.wParam));
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3408 /* Reply is not expected. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3409 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3410 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
3411 focus_window = GetFocus ();
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3412 if (focus_window != NULL)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3413 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
3414 /* 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
3415 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
3416 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
3417 GC. */
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3418 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
3419 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
3420 abort ();
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3421 break;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3422 case WM_EMACS_TOGGLE_LOCK_KEY:
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3423 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3424 int vk_code = (int) msg.wParam;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3425 int cur_state = (GetKeyState (vk_code) & 1);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3426 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
3427
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3428 /* 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
3429 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
3430 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
3431 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
3432 immediate values. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3433 if (NILP (new_state)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3434 || (NUMBERP (new_state)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3435 && (XUINT (new_state)) & 1 != cur_state))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3436 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3437 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
3438
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3439 keybd_event ((BYTE) vk_code,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3440 (BYTE) MapVirtualKey (vk_code, 0),
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3441 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3442 keybd_event ((BYTE) vk_code,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3443 (BYTE) MapVirtualKey (vk_code, 0),
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3444 KEYEVENTF_EXTENDEDKEY | 0, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3445 keybd_event ((BYTE) vk_code,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3446 (BYTE) MapVirtualKey (vk_code, 0),
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3447 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3448 cur_state = !cur_state;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3449 }
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3450 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3451 cur_state, 0))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3452 abort ();
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3453 }
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3454 break;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3455 default:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3456 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
3457 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3458 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3459 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3460 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3461 DispatchMessage (&msg);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3462 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3463
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3464 /* 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
3465 if (msg_buf->completed)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3466 break;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3467 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3468 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3469
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3470 deferred_msg * deferred_msg_head;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3471
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3472 static deferred_msg *
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3473 find_deferred_msg (HWND hwnd, UINT msg)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3474 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3475 deferred_msg * item;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3476
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3477 /* 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
3478 modification of single pointer is always atomic. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3479 /* enter_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3480
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3481 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
3482 if (item->w32msg.msg.hwnd == hwnd
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3483 && item->w32msg.msg.message == msg)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3484 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3485
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3486 /* leave_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3487
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3488 return item;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3489 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3490
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3491 static LRESULT
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3492 send_deferred_msg (deferred_msg * msg_buf,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3493 HWND hwnd,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3494 UINT msg,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3495 WPARAM wParam,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3496 LPARAM lParam)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3497 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3498 /* Only input thread can send deferred messages. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3499 if (GetCurrentThreadId () != dwWindowsThreadId)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3500 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3501
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3502 /* 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
3503 if (find_deferred_msg (hwnd, msg) != NULL)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3504 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3505
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3506 /* 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
3507 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
3508 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
3509 input thread can call us). */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3510
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3511 /* enter_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3512
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3513 msg_buf->completed = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3514 msg_buf->next = deferred_msg_head;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3515 deferred_msg_head = msg_buf;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3516 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
3517
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3518 /* leave_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3519
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3520 /* 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
3521 this one is completed. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3522 w32_msg_pump (msg_buf);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3523
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3524 deferred_msg_head = msg_buf->next;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3525
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3526 return msg_buf->result;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3527 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3528
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3529 void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3530 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
3531 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3532 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
3533
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3534 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
3535 /* 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
3536 return;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3537
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3538 msg_buf->result = result;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3539 msg_buf->completed = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3540
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3541 /* 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
3542 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3543 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3544
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3545 void
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3546 cancel_all_deferred_msgs ()
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3547 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3548 deferred_msg * item;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3549
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3550 /* 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
3551 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
3552 /* enter_crit (); */
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3553
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3554 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
3555 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3556 item->result = 0;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3557 item->completed = 1;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3558 }
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3559
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3560 /* leave_crit (); */
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3561
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3562 /* 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
3563 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
3564 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3565
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3566 DWORD
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3567 w32_msg_worker (dw)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3568 DWORD dw;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3569 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3570 MSG msg;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3571 deferred_msg dummy_buf;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3572
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3573 /* 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
3574
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3575 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3576
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3577 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
3578 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3579
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3580 memset (&dummy_buf, 0, sizeof (dummy_buf));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3581 dummy_buf.w32msg.msg.hwnd = NULL;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3582 dummy_buf.w32msg.msg.message = WM_NULL;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3583
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3584 /* 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
3585 application quits. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3586 w32_msg_pump (&dummy_buf);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3587
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3588 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3589 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3590
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3591 static void
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3592 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
3593 HWND hwnd;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3594 UINT msg;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3595 WPARAM wParam;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3596 LPARAM lParam;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3597 DWORD modifiers;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3598
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3599 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3600 W32Msg wmsg;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3601
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3602 wmsg.dwModifiers = modifiers;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3603
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3604 /* 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
3605 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
3606 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
3607 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
3608 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
3609 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
3610 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3611 int c = wParam;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3612 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
3613 c = make_ctrl_char (c) & 0377;
24339
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
3614 if (c == quit_char
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
3615 || (wmsg.dwModifiers == 0 &&
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
3616 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
3617 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3618 Vquit_flag = Qt;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3619
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3620 /* 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
3621 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
3622 msg = WM_NULL;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3623
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3624 /* 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
3625 signal_quit ();
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3626
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3627 /* 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
3628 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
3629 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
3630 "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
3631 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
3632 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
3633 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
3634 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
3635 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
3636 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
3637 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
3638 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
3639 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
3640 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
3641
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3642 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
3643 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
3644 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
3645 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
3646 cancel_all_deferred_msgs ();
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3647 }
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3648 }
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3649
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3650 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
3651 }
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
3652
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3653 /* Main window procedure */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3654
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3655 LRESULT CALLBACK
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3656 w32_wnd_proc (hwnd, msg, wParam, lParam)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3657 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3658 UINT msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3659 WPARAM wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3660 LPARAM lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3661 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3662 struct frame *f;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3663 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
3664 W32Msg wmsg;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3665 int windows_translate;
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3666 int key;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3667
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3668 /* 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
3669 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
3670 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
3671 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
3672 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
3673
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3674 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
3675 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
3676 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
3677 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
3678 delete-frame has synchronized with this thread.
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3679
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3680 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
3681 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
3682 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
3683
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3684 switch (msg)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3685 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3686 case WM_ERASEBKGND:
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3687 f = x_window_to_frame (dpyinfo, hwnd);
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3688 if (f)
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3689 {
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3690 GetUpdateRect (hwnd, &wmsg.rect, FALSE);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3691 w32_clear_rect (f, NULL, &wmsg.rect);
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3692
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3693 #if defined (W32_DEBUG_DISPLAY)
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3694 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
3695 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
3696 wmsg.rect.bottom));
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3697 #endif /* W32_DEBUG_DISPLAY */
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3698 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3699 return 1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3700 case WM_PALETTECHANGED:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3701 /* ignore our own changes */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3702 if ((HWND)wParam != hwnd)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3703 {
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3704 f = x_window_to_frame (dpyinfo, hwnd);
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3705 if (f)
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3706 /* 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
3707 frames to be redrawn if needed. */
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
3708 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
3709 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3710 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3711 case WM_PAINT:
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3712 {
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3713 PAINTSTRUCT paintStruct;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3714 RECT update_rect;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3715
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3716 /* MSDN Docs say not to call BeginPaint if GetUpdateRect
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3717 fails. Apparently this can happen under some
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3718 circumstances. */
24695
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
3719 if (!w32_strict_painting || GetUpdateRect (hwnd, &update_rect, FALSE))
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3720 {
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3721 enter_crit ();
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3722 BeginPaint (hwnd, &paintStruct);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3723
24695
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
3724 if (w32_strict_painting)
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
3725 /* The rectangles returned by GetUpdateRect and BeginPaint
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
3726 do not always match. GetUpdateRect seems to be the
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
3727 more reliable of the two. */
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
3728 wmsg.rect = update_rect;
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
3729 else
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
3730 wmsg.rect = paintStruct.rcPaint;
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3731
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3732 #if defined (W32_DEBUG_DISPLAY)
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3733 DebPrint (("WM_PAINT: painting %d,%d-%d,%d\n", wmsg.rect.left,
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3734 wmsg.rect.top, wmsg.rect.right, wmsg.rect.bottom));
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3735 DebPrint (("WM_PAINT: update region is %d,%d-%d,%d\n",
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3736 update_rect.left, update_rect.top,
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3737 update_rect.right, update_rect.bottom));
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3738 #endif
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3739 EndPaint (hwnd, &paintStruct);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3740 leave_crit ();
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3741
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3742 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3743
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3744 return 0;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
3745 }
24695
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
3746
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
3747 /* If GetUpdateRect returns 0 (meaning there is no update
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
3748 region), assume the whole window needs to be repainted. */
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
3749 GetClientRect(hwnd, &wmsg.rect);
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
3750 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
3751 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3752 }
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3753
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3754 case WM_INPUTLANGCHANGE:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3755 /* 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
3756 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
3757
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3758 /* 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
3759 preserve modifier key states. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3760 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3761 int i;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3762 BYTE keystate[256];
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3763
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3764 GetKeyboardState (keystate);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3765 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
3766 if (1
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3767 && i != VK_SHIFT
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3768 && i != VK_LSHIFT
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3769 && i != VK_RSHIFT
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3770 && i != VK_CAPITAL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3771 && i != VK_NUMLOCK
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3772 && i != VK_SCROLL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3773 && i != VK_CONTROL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3774 && i != VK_LCONTROL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3775 && i != VK_RCONTROL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3776 && i != VK_MENU
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3777 && i != VK_LMENU
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3778 && i != VK_RMENU
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3779 && i != VK_LWIN
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3780 && i != VK_RWIN)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3781 keystate[i] = 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3782 SetKeyboardState (keystate);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3783 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3784 goto dflt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3785
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3786 case WM_HOTKEY:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3787 /* 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
3788 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
3789 return (0);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3790
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3791 case WM_KEYUP:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3792 case WM_SYSKEYUP:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3793 record_keyup (wParam, lParam);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3794 goto dflt;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3795
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3796 case WM_KEYDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3797 case WM_SYSKEYDOWN:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3798 /* 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
3799 if (dpyinfo->faked_key == wParam)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3800 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3801 dpyinfo->faked_key = 0;
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3802 /* 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
3803 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
3804 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
3805 example. */
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3806 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
3807 {
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3808 windows_translate = 1;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3809 goto translate;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3810 }
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3811 return 0;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3812 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3813
15377
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3814 /* Synchronize modifiers with current keystroke. */
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3815 sync_modifiers ();
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3816 record_keydown (wParam, lParam);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3817 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
3818
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3819 windows_translate = 0;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3820
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3821 switch (wParam)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3822 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3823 case VK_LWIN:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3824 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
3825 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3826 /* 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
3827 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
3828 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
3829 if (GetAsyncKeyState (wParam) & 1)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3830 {
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3831 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
3832 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
3833 else
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3834 key = VK_SPACE;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3835 dpyinfo->faked_key = key;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3836 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
3837 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3838 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3839 if (!NILP (Vw32_lwindow_modifier))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3840 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3841 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3842 case VK_RWIN:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3843 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
3844 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3845 if (GetAsyncKeyState (wParam) & 1)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3846 {
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3847 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
3848 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
3849 else
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3850 key = VK_SPACE;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3851 dpyinfo->faked_key = key;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3852 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
3853 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3854 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3855 if (!NILP (Vw32_rwindow_modifier))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3856 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3857 break;
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3858 case VK_APPS:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3859 if (!NILP (Vw32_apps_modifier))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3860 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3861 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3862 case VK_MENU:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3863 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
3864 /* 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
3865 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
3866 return 0;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3867 windows_translate = 1;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3868 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3869 case VK_CAPITAL:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3870 /* 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
3871 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
3872 goto disable_lock_key;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3873 windows_translate = 1;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3874 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3875 case VK_NUMLOCK:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3876 /* 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
3877 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
3878 goto disable_lock_key;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3879 windows_translate = 1;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3880 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3881 case VK_SCROLL:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3882 /* 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
3883 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
3884 goto disable_lock_key;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3885 windows_translate = 1;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3886 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3887 disable_lock_key:
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3888 /* 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
3889 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
3890 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
3891 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
3892 dpyinfo->faked_key = wParam;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3893 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
3894 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3895 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
3896 KEYEVENTF_EXTENDEDKEY | 0, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3897 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
3898 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3899 /* 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
3900 (TranslateMessage apparently does this), after forwarding
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3901 input event. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3902 post_character_message (hwnd, msg, wParam, lParam,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3903 w32_get_key_modifiers (wParam, lParam));
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3904 windows_translate = 1;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3905 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3906 case VK_CONTROL:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3907 case VK_SHIFT:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3908 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
3909 windows_translate = 1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3910 break;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3911 case VK_CANCEL:
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3912 /* 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
3913 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
3914 VK_CANCEL events into VK_PAUSE events. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3915 wParam = VK_PAUSE;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3916 break;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3917 case VK_PAUSE:
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3918 /* 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
3919 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
3920 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
3921 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
3922 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
3923 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
3924 wParam = VK_NUMLOCK;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3925 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3926 default:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3927 /* 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
3928 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
3929 {
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3930 DWORD modifiers = construct_console_modifiers ();
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3931
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3932 if (!NILP (Vw32_recognize_altgr)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3933 && 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
3934 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3935 /* 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
3936 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
3937 chords correctly. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3938 windows_translate = 1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3939 }
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3940 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
3941 {
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3942 /* Handle key chords including any modifiers other
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3943 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
3944 modifier information as possible. */
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3945 if ('A' <= wParam && wParam <= 'Z')
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3946 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3947 /* 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
3948 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
3949 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
3950 the normal layout translates alphabetic
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3951 characters to non-ascii characters. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3952 if (!modifier_set (VK_SHIFT))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3953 wParam += ('a' - 'A');
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3954 msg = WM_CHAR;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3955 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3956 else
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3957 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3958 /* 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
3959 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
3960 shift modifier). */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3961 int add;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3962 int isdead = 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3963 KEY_EVENT_RECORD key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3964
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3965 key.bKeyDown = TRUE;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3966 key.wRepeatCount = 1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3967 key.wVirtualKeyCode = wParam;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3968 key.wVirtualScanCode = (lParam & 0xFF0000) >> 16;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3969 key.uChar.AsciiChar = 0;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3970 key.dwControlKeyState = modifiers;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3971
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3972 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
3973 /* 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
3974 dead key. Ignore both. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3975 while (--add >= 0)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3976 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3977 /* Forward asciified character sequence. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3978 post_character_message
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3979 (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
3980 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
3981 w32_kbd_patch_key (&key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3982 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3983 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3984 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3985 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3986 else
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3987 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3988 /* Let TranslateMessage handle everything else. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3989 windows_translate = 1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3990 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3991 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3992 }
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3993
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3994 translate:
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3995 if (windows_translate)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3996 {
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
3997 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
3998
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
3999 windows_msg.time = GetMessageTime ();
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
4000 TranslateMessage (&windows_msg);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4001 goto dflt;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4002 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4003
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4004 /* Fall through */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4005
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4006 case WM_SYSCHAR:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4007 case WM_CHAR:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4008 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
4009 w32_get_key_modifiers (wParam, lParam));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4010 break;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
4011
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4012 /* 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
4013 are used together, but only if user has two button mouse. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4014 case WM_LBUTTONDOWN:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4015 case WM_RBUTTONDOWN:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4016 if (XINT (Vw32_num_mouse_buttons) == 3)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4017 goto handle_plain_button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4018
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4019 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4020 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
4021 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
4022
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4023 if (button_state & this)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4024 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4025
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4026 if (button_state == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4027 SetCapture (hwnd);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4028
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4029 button_state |= this;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4030
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4031 if (button_state & other)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4032 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4033 if (mouse_button_timer)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4034 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4035 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4036 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4037
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4038 /* Generate middle mouse event instead. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4039 msg = WM_MBUTTONDOWN;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4040 button_state |= MMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4041 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4042 else if (button_state & MMOUSE)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4043 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4044 /* 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
4045 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
4046 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
4047 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
4048 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4049 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4050 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4051 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4052 /* Flush out saved message. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4053 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
4054 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4055 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
4056 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
4057
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4058 /* Clear message buffer. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4059 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
4060 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4061 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4062 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4063 /* Hold onto message for now. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4064 mouse_button_timer =
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4065 SetTimer (hwnd, MOUSE_BUTTON_ID,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4066 XINT (Vw32_mouse_button_tolerance), NULL);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4067 saved_mouse_button_msg.msg.hwnd = hwnd;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4068 saved_mouse_button_msg.msg.message = msg;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4069 saved_mouse_button_msg.msg.wParam = wParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4070 saved_mouse_button_msg.msg.lParam = lParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4071 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
4072 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
4073 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4074 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4075 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4076
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4077 case WM_LBUTTONUP:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4078 case WM_RBUTTONUP:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4079 if (XINT (Vw32_num_mouse_buttons) == 3)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4080 goto handle_plain_button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4081
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4082 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4083 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
4084 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
4085
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4086 if ((button_state & this) == 0)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4087 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4088
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4089 button_state &= ~this;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4090
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4091 if (button_state & MMOUSE)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4092 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4093 /* 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
4094 if ((button_state & other) == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4095 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4096 msg = WM_MBUTTONUP;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4097 button_state &= ~MMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4098
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4099 if (button_state) abort ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4100 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4101 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4102 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4103 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4104 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4105 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4106 /* Flush out saved message if necessary. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4107 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
4108 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4109 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
4110 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4111 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4112 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
4113 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
4114
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4115 /* 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
4116 saved_mouse_button_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4117 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4118 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4119
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4120 if (button_state == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4121 ReleaseCapture ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4122 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4123 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4124
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4125 case WM_MBUTTONDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4126 case WM_MBUTTONUP:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4127 handle_plain_button:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4128 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4129 BOOL up;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4130 int button;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4131
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4132 if (parse_button (msg, &button, &up))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4133 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4134 if (up) ReleaseCapture ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4135 else SetCapture (hwnd);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4136 button = (button == 0) ? LMOUSE :
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4137 ((button == 1) ? MMOUSE : RMOUSE);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4138 if (up)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4139 button_state &= ~button;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4140 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4141 button_state |= button;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4142 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4143 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4144
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4145 wmsg.dwModifiers = w32_get_modifiers ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4146 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
4147 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4148
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4149 case WM_VSCROLL:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4150 case WM_MOUSEMOVE:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4151 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
4152 || (msg == WM_MOUSEMOVE && button_state == 0))
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4153 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4154 wmsg.dwModifiers = w32_get_modifiers ();
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4155 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
4156 return 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4157 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4158
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4159 /* 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
4160 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
4161 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
4162 expires, we just replace the first message. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4163
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4164 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
4165 mouse_move_timer =
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4166 SetTimer (hwnd, MOUSE_MOVE_ID,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4167 XINT (Vw32_mouse_move_interval), NULL);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4168
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4169 /* Hold onto message for now. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4170 saved_mouse_move_msg.msg.hwnd = hwnd;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4171 saved_mouse_move_msg.msg.message = msg;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4172 saved_mouse_move_msg.msg.wParam = wParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4173 saved_mouse_move_msg.msg.lParam = lParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4174 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
4175 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
4176
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4177 return 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4178
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4179 case WM_MOUSEWHEEL:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4180 wmsg.dwModifiers = w32_get_modifiers ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4181 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
4182 return 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4183
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
4184 case WM_DROPFILES:
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
4185 wmsg.dwModifiers = w32_get_modifiers ();
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
4186 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
4187 return 0;
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
4188
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4189 case WM_TIMER:
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4190 /* Flush out saved messages if necessary. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4191 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
4192 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4193 if (saved_mouse_button_msg.msg.hwnd)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4194 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4195 post_msg (&saved_mouse_button_msg);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4196 saved_mouse_button_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4197 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4198 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4199 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4200 }
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4201 else if (wParam == mouse_move_timer)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4202 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4203 if (saved_mouse_move_msg.msg.hwnd)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4204 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4205 post_msg (&saved_mouse_move_msg);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4206 saved_mouse_move_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4207 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4208 KillTimer (hwnd, mouse_move_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4209 mouse_move_timer = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4210 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4211 return 0;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4212
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4213 case WM_NCACTIVATE:
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4214 /* 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
4215 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
4216 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
4217 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
4218 keyboard modifiers' state. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4219 reset_modifiers ();
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4220 goto dflt;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
4221
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4222 case WM_INITMENU:
24751
e0eaca5025bc (w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents: 24718
diff changeset
4223 button_state = 0;
e0eaca5025bc (w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents: 24718
diff changeset
4224 ReleaseCapture ();
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4225 /* 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
4226 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
4227 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
4228 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
4229 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
4230
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4231 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
4232 loop that can process all other messages.
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4233
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4234 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
4235 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
4236 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
4237 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
4238 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
4239 being active). */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4240
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4241 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4242 if (f
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4243 && (f->output_data.w32->menubar_active
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4244 /* 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
4245 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
4246 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
4247 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
4248 had requested it to be turned off! */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4249 || f->output_data.w32->menubar_widget == NULL))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4250 return 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4251
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4252 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4253 deferred_msg msg_buf;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4254
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4255 /* 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
4256 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
4257 if (find_deferred_msg (hwnd, msg) != NULL)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4258 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4259
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4260 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
4261 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4262
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4263 case WM_EXITMENULOOP:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4264 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4265
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4266 /* Indicate that menubar can be modified again. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4267 if (f)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4268 f->output_data.w32->menubar_active = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4269 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4270
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4271 case WM_MEASUREITEM:
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4272 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
4273 if (f)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4274 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4275 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
4276
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4277 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
4278 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4279 /* 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
4280 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
4281 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
4282 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
4283 LOGFONT menu_logfont;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4284 HFONT old_font;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4285 SIZE size;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4286
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4287 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
4288 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
4289 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
4290 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
4291
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4292 GetTextExtentPoint32 (hdc, title, strlen (title), &size);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4293 pMis->itemWidth = size.cx;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4294 pMis->itemHeight = GetSystemMetrics (SM_CYMENUSIZE);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4295 if (pMis->itemHeight < size.cy)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4296 pMis->itemHeight = size.cy;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4297
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4298 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
4299 DeleteObject (menu_font);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4300 ReleaseDC (hwnd, hdc);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4301 return TRUE;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4302 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4303 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4304 return 0;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4305
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4306 case WM_DRAWITEM:
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4307 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
4308 if (f)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4309 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4310 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
4311
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4312 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
4313 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4314 /* 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
4315 char * title = (char *) pDis->itemData;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4316 HDC hdc = pDis->hDC;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4317 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
4318 LOGFONT menu_logfont;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4319 HFONT old_font;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4320
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4321 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
4322 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
4323 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
4324 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
4325
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4326 /* Always draw title as if not selected. */
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4327 ExtTextOut (hdc,
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4328 pDis->rcItem.left + GetSystemMetrics (SM_CXMENUCHECK),
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4329 pDis->rcItem.top,
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4330 ETO_OPAQUE, &pDis->rcItem,
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4331 title, strlen (title), NULL);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4332
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4333 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
4334 DeleteObject (menu_font);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4335 return TRUE;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4336 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4337 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4338 return 0;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4339
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4340 #if 0
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4341 /* 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
4342 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
4343 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
4344 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
4345 case WM_MOUSEACTIVATE:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4346 /* 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
4347 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
4348 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
4349 if (LOWORD (lParam) == HTCLIENT )
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4350 return MA_ACTIVATEANDEAT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4351 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4352 #endif
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4353
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4354 case WM_ACTIVATEAPP:
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4355 case WM_ACTIVATE:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4356 case WM_WINDOWPOSCHANGED:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4357 case WM_SHOWWINDOW:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4358 /* 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
4359 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
4360 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
4361 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4362
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
4363 case WM_SETFOCUS:
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4364 dpyinfo->faked_key = 0;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
4365 reset_modifiers ();
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4366 register_hot_keys (hwnd);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4367 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
4368 case WM_KILLFOCUS:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4369 unregister_hot_keys (hwnd);
24751
e0eaca5025bc (w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents: 24718
diff changeset
4370 button_state = 0;
e0eaca5025bc (w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents: 24718
diff changeset
4371 ReleaseCapture ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4372 case WM_MOVE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4373 case WM_SIZE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4374 case WM_COMMAND:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
4375 command:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4376 wmsg.dwModifiers = w32_get_modifiers ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4377 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4378 goto dflt;
15034
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
4379
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
4380 case WM_CLOSE:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4381 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
4382 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
4383 return 0;
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
4384
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4385 case WM_WINDOWPOSCHANGING:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4386 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4387 WINDOWPLACEMENT wp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4388 LPWINDOWPOS lppos = (WINDOWPOS *) lParam;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4389
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4390 wp.length = sizeof (WINDOWPLACEMENT);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4391 GetWindowPlacement (hwnd, &wp);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4392
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4393 if (wp.showCmd != SW_SHOWMINIMIZED && (lppos->flags & SWP_NOSIZE) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4394 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4395 RECT rect;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4396 int wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4397 int hdiff;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4398 DWORD font_width;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4399 DWORD line_height;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4400 DWORD internal_border;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4401 DWORD scrollbar_extra;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4402 RECT wr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4403
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4404 wp.length = sizeof(wp);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4405 GetWindowRect (hwnd, &wr);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4406
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4407 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4408
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4409 font_width = GetWindowLong (hwnd, WND_FONTWIDTH_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4410 line_height = GetWindowLong (hwnd, WND_LINEHEIGHT_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4411 internal_border = GetWindowLong (hwnd, WND_BORDER_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4412 scrollbar_extra = GetWindowLong (hwnd, WND_SCROLLBAR_INDEX);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4413
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4414 leave_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4415
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4416 memset (&rect, 0, sizeof (rect));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4417 AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4418 GetMenu (hwnd) != NULL);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4419
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4420 /* 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
4421 multiples of the character cell dimensions. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4422 wdiff = (lppos->cx - (rect.right - rect.left)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4423 - 2 * internal_border - scrollbar_extra)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4424 % font_width;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4425 hdiff = (lppos->cy - (rect.bottom - rect.top)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4426 - 2 * internal_border)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4427 % line_height;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4428
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4429 if (wdiff || hdiff)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4430 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4431 /* For right/bottom sizing we can just fix the sizes.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4432 However for top/left sizing we will need to fix the X
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4433 and Y positions as well. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4435 lppos->cx -= wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4436 lppos->cy -= hdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4437
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4438 if (wp.showCmd != SW_SHOWMAXIMIZED
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4439 && (lppos->flags & SWP_NOMOVE) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4440 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4441 if (lppos->x != wr.left || lppos->y != wr.top)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4442 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4443 lppos->x += wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4444 lppos->y += hdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4445 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4446 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4447 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4448 lppos->flags |= SWP_NOMOVE;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4449 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4450 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4451
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4452 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4453 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4454 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4455 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4456
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4457 goto dflt;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4458
24479
3b2c3636bf0e (w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24412
diff changeset
4459 case WM_GETMINMAXINFO:
3b2c3636bf0e (w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24412
diff changeset
4460 /* 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
4461 below the Minimum Tracking Size. */
3b2c3636bf0e (w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24412
diff changeset
4462 ((LPMINMAXINFO) lParam)->ptMinTrackSize.y++;
3b2c3636bf0e (w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24412
diff changeset
4463 return 0;
3b2c3636bf0e (w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24412
diff changeset
4464
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4465 case WM_EMACS_CREATESCROLLBAR:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4466 return (LRESULT) w32_createscrollbar ((struct frame *) wParam,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4467 (struct scroll_bar *) lParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4468
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4469 case WM_EMACS_SHOWWINDOW:
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4470 return ShowWindow ((HWND) wParam, (WPARAM) lParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4471
21608
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
4472 case WM_EMACS_SETFOREGROUND:
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4473 {
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4474 HWND foreground_window;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4475 DWORD foreground_thread, retval;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4476
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4477 /* 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
4478 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
4479 pull the focus away from it. */
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4480 foreground_window = GetForegroundWindow ();
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4481 foreground_thread = GetWindowThreadProcessId (foreground_window, NULL);
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4482 if (!foreground_window
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4483 || foreground_thread == GetCurrentThreadId ()
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4484 || !AttachThreadInput (GetCurrentThreadId (),
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4485 foreground_thread, TRUE))
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4486 foreground_thread = 0;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4487
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4488 retval = SetForegroundWindow ((HWND) wParam);
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4489
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4490 /* Detach from the previous foreground thread. */
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4491 if (foreground_thread)
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4492 AttachThreadInput (GetCurrentThreadId (),
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4493 foreground_thread, FALSE);
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4494
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4495 return retval;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4496 }
21608
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
4497
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4498 case WM_EMACS_SETWINDOWPOS:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4499 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4500 WINDOWPOS * pos = (WINDOWPOS *) wParam;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4501 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
4502 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
4503 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4504
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4505 case WM_EMACS_DESTROYWINDOW:
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
4506 DragAcceptFiles ((HWND) wParam, FALSE);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4507 return DestroyWindow ((HWND) wParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4508
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4509 case WM_EMACS_TRACKPOPUPMENU:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4510 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4511 UINT flags;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4512 POINT *pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4513 int retval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4514 pos = (POINT *)lParam;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4515 flags = TPM_CENTERALIGN;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4516 if (button_state & LMOUSE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4517 flags |= TPM_LEFTBUTTON;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4518 else if (button_state & RMOUSE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4519 flags |= TPM_RIGHTBUTTON;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4520
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
4521 /* 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
4522 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
4523 ReleaseCapture ();
23160
95a213639589 (w32_wnd_proc): Always zero button_state when releasing
Geoff Voelker <voelker@cs.washington.edu>
parents: 22625
diff changeset
4524 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
4525
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4526 /* 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
4527 TrackPopupMenu below, and should be ignored. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4528 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4529 if (f)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4530 f->output_data.w32->menubar_active = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4531
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4532 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
4533 0, hwnd, NULL))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4534 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4535 MSG amsg;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4536 /* Eat any mouse messages during popupmenu */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4537 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
4538 PM_REMOVE));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4539 /* Get the menu selection, if any */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4540 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
4541 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4542 retval = LOWORD (amsg.wParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4543 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4544 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4545 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4546 retval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4547 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4548 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4549 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4550 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4551 retval = -1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4552 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4553
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4554 return retval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4555 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4556
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4557 default:
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4558 /* Check for messages registered at runtime. */
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4559 if (msg == msh_mousewheel)
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4560 {
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4561 wmsg.dwModifiers = w32_get_modifiers ();
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4562 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4563 return 0;
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4564 }
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
4565
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4566 dflt:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4567 return DefWindowProc (hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4568 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4569
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4570
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4571 /* 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
4572 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4573 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4574
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4575 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4576 my_create_window (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4577 struct frame * f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4578 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4579 MSG msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4580
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4581 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
4582 abort ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4583 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4584 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4585
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4586 /* Create and set up the w32 window for frame F. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4587
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4588 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4589 w32_window (f, window_prompting, minibuffer_only)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4590 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4591 long window_prompting;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4592 int minibuffer_only;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4593 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4594 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4595
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4596 /* Use the resource name as the top-level window name
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4597 for looking up resources. Make a non-Lisp copy
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4598 for the window manager, so GC relocation won't bother it.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4599
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4600 Elsewhere we specify the window name for the window manager. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4601
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4602 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4603 char *str = (char *) XSTRING (Vx_resource_name)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4604 f->namebuf = (char *) xmalloc (strlen (str) + 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4605 strcpy (f->namebuf, str);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4606 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4607
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4608 my_create_window (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4609
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4610 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4611
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4612 /* x_set_name normally ignores requests to set the name if the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4613 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
4614 place where that assumption isn't correct; f->name is set, but
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4615 the server hasn't been told. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4616 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4617 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4618 int explicit = f->explicit_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4619
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4620 f->explicit_name = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4621 name = f->name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4622 f->name = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4623 x_set_name (f, name, explicit);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4624 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4625
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4626 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4627
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4628 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4629 initialize_frame_menubar (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4630
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4631 if (FRAME_W32_WINDOW (f) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4632 error ("Unable to create window");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4633 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4634
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4635 /* Handle the icon stuff for this window. Perhaps later we might
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4636 want an x_set_icon_position which can be called interactively as
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4637 well. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4638
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4639 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4640 x_icon (f, parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4641 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4642 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4643 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4644 Lisp_Object icon_x, icon_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4645
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
4646 /* 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
4647 icons in the tray. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4648 icon_x = x_get_arg (parms, Qicon_left, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4649 icon_y = x_get_arg (parms, Qicon_top, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4650 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4651 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4652 CHECK_NUMBER (icon_x, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4653 CHECK_NUMBER (icon_y, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4654 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4655 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4656 error ("Both left and top icon corners of icon must be specified");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4657
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4658 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4659
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4660 if (! EQ (icon_x, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4661 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4662
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4663 #if 0 /* TODO */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4664 /* Start up iconic or window? */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4665 x_wm_set_window_state
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4666 (f, (EQ (x_get_arg (parms, Qvisibility, 0, 0, symbol), Qicon)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4667 ? IconicState
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4668 : NormalState));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4669
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4670 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
4671 ? f->icon_name
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4672 : f->name))->data);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4673 #endif
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4674
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4675 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4676 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4677
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4678 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4679 1, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4680 "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
4681 Returns an Emacs frame object.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4682 ALIST is an alist of frame parameters.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4683 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
4684 and do not specify a specific minibuffer window to use,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4685 then `default-minibuffer-frame' must be a frame whose minibuffer can\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4686 be shared by the new frame.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4687 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4688 This function is an internal primitive--use `make-frame' instead.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4689 (parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4690 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4691 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4692 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4693 Lisp_Object frame, tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4694 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4695 int minibuffer_only = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4696 long window_prompting = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4697 int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4698 int count = specpdl_ptr - specpdl;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4699 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4700 Lisp_Object display;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4701 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4702 Lisp_Object parent;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4703 struct kboard *kb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4704
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4705 check_w32 ();
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4706
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4707 /* Use this general default value to start with
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4708 until we know if this frame has a specified name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4709 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4710
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4711 display = x_get_arg (parms, Qdisplay, 0, 0, string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4712 if (EQ (display, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4713 display = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4714 dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4715 #ifdef MULTI_KBOARD
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4716 kb = dpyinfo->kboard;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4717 #else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4718 kb = &the_only_kboard;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4719 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4720
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4721 name = x_get_arg (parms, Qname, "name", "Name", string);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4722 if (!STRINGP (name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4723 && ! EQ (name, Qunbound)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4724 && ! NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4725 error ("Invalid frame name--not a string or nil");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4726
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4727 if (STRINGP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4728 Vx_resource_name = name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4729
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4730 /* See if parent window is specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4731 parent = x_get_arg (parms, Qparent_id, NULL, NULL, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4732 if (EQ (parent, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4733 parent = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4734 if (! NILP (parent))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4735 CHECK_NUMBER (parent, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4736
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4737 /* 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
4738 /* 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
4739 it to make_frame_without_minibuffer. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4740 frame = Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4741 GCPRO4 (parms, parent, name, frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4742 tem = x_get_arg (parms, Qminibuffer, 0, 0, symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4743 if (EQ (tem, Qnone) || NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4744 f = make_frame_without_minibuffer (Qnil, kb, display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4745 else if (EQ (tem, Qonly))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4746 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4747 f = make_minibuffer_frame ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4748 minibuffer_only = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4749 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4750 else if (WINDOWP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4751 f = make_frame_without_minibuffer (tem, kb, display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4752 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4753 f = make_frame (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4754
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4755 XSETFRAME (frame, f);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4756
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4757 /* Note that Windows does support scroll bars. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4758 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
4759 /* 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
4760 f->scroll_bar_pixel_width = GetSystemMetrics (SM_CXVSCROLL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4761
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4762 f->output_method = output_w32;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4763 f->output_data.w32 = (struct w32_output *) xmalloc (sizeof (struct w32_output));
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4764 bzero (f->output_data.w32, sizeof (struct w32_output));
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4765
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4766 FRAME_FONTSET (f) = -1;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4767
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4768 f->icon_name
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4769 = x_get_arg (parms, Qicon_name, "iconName", "Title", string);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4770 if (! STRINGP (f->icon_name))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4771 f->icon_name = Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4772
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4773 /* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4774 #ifdef MULTI_KBOARD
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4775 FRAME_KBOARD (f) = kb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4776 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4777
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4778 /* Specify the parent under which to make this window. */
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 if (!NILP (parent))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4781 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4782 f->output_data.w32->parent_desc = (Window) parent;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4783 f->output_data.w32->explicit_parent = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4784 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4785 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4786 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4787 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
4788 f->output_data.w32->explicit_parent = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4789 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4790
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4791 /* Note that the frame has no physical cursor right now. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4792 f->phys_cursor_x = -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4793
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4794 /* 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
4795 be set. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4796 if (EQ (name, Qunbound) || NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4797 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4798 f->name = build_string (dpyinfo->w32_id_name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4799 f->explicit_name = 0;
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 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4802 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4803 f->name = name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4804 f->explicit_name = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4805 /* use the frame's title when getting resources for this frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4806 specbind (Qx_resource_name, name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4807 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4808
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4809 /* Create fontsets from `global_fontset_alist' before handling fonts. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4810 for (tem = Vglobal_fontset_alist; CONSP (tem); tem = XCONS (tem)->cdr)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4811 fs_register_fontset (f, XCONS (tem)->car);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4812
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4813 /* Extract the window parameters from the supplied values
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4814 that are needed to determine window geometry. */
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 Lisp_Object font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4817
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4818 font = x_get_arg (parms, Qfont, "font", "Font", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4819 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4820 /* First, try whatever font the caller has specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4821 if (STRINGP (font))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4822 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4823 tem = Fquery_fontset (font, Qnil);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4824 if (STRINGP (tem))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4825 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
4826 else
24481
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
4827 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
4828 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4829 /* Try out a font which we hope has bold and italic variations. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4830 if (!STRINGP (font))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4831 font = x_new_font (f, "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-iso8859-1");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4832 if (! STRINGP (font))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4833 font = x_new_font (f, "-*-Courier-normal-r-*-*-*-97-*-*-c-*-iso8859-1");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4834 /* 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
4835 if (! STRINGP (font))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4836 font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-*-*-90-*-c-*-iso8859-1");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4837 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4838 if (! STRINGP (font))
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4839 font = build_string ("Fixedsys");
13434
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 x_default_parameter (f, parms, Qfont, font,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4842 "font", "Font", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4843 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4844
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4845 x_default_parameter (f, parms, Qborder_width, make_number (2),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4846 "borderwidth", "BorderWidth", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4847 /* This defaults to 2 in order to match xterm. We recognize either
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4848 internalBorderWidth or internalBorder (which is what xterm calls
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4849 it). */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4850 if (NILP (Fassq (Qinternal_border_width, parms)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4851 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4852 Lisp_Object value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4853
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4854 value = x_get_arg (parms, Qinternal_border_width,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4855 "internalBorder", "BorderWidth", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4856 if (! EQ (value, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4857 parms = Fcons (Fcons (Qinternal_border_width, value),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4858 parms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4859 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4860 /* Default internalBorderWidth to 0 on Windows to match other programs. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4861 x_default_parameter (f, parms, Qinternal_border_width, make_number (0),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4862 "internalBorderWidth", "BorderWidth", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4863 x_default_parameter (f, parms, Qvertical_scroll_bars, Qt,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4864 "verticalScrollBars", "ScrollBars", boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4865
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4866 /* Also do the stuff which must be set before the window exists. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4867 x_default_parameter (f, parms, Qforeground_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4868 "foreground", "Foreground", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4869 x_default_parameter (f, parms, Qbackground_color, build_string ("white"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4870 "background", "Background", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4871 x_default_parameter (f, parms, Qmouse_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4872 "pointerColor", "Foreground", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4873 x_default_parameter (f, parms, Qcursor_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4874 "cursorColor", "Foreground", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4875 x_default_parameter (f, parms, Qborder_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4876 "borderColor", "BorderColor", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4877
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4878 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4879 "menuBar", "MenuBar", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4880 x_default_parameter (f, parms, Qscroll_bar_width, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4881 "scrollBarWidth", "ScrollBarWidth", number);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4882 x_default_parameter (f, parms, Qbuffer_predicate, Qnil,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4883 "bufferPredicate", "BufferPredicate", symbol);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4884 x_default_parameter (f, parms, Qtitle, Qnil,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4885 "title", "Title", string);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4886
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4887 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
4888 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
4889 window_prompting = x_figure_window_size (f, parms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4890
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4891 if (window_prompting & XNegative)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4892 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4893 if (window_prompting & YNegative)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4894 f->output_data.w32->win_gravity = SouthEastGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4895 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4896 f->output_data.w32->win_gravity = NorthEastGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4897 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4898 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4899 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4900 if (window_prompting & YNegative)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4901 f->output_data.w32->win_gravity = SouthWestGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4902 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4903 f->output_data.w32->win_gravity = NorthWestGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4904 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4905
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4906 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
4907
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4908 w32_window (f, window_prompting, minibuffer_only);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4909 x_icon (f, parms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4910 init_frame_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4911
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4912 /* We need to do this after creating the window, so that the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4913 icon-creation functions can say whose icon they're describing. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4914 x_default_parameter (f, parms, Qicon_type, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4915 "bitmapIcon", "BitmapIcon", symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4916
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4917 x_default_parameter (f, parms, Qauto_raise, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4918 "autoRaise", "AutoRaiseLower", boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4919 x_default_parameter (f, parms, Qauto_lower, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4920 "autoLower", "AutoRaiseLower", boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4921 x_default_parameter (f, parms, Qcursor_type, Qbox,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4922 "cursorType", "CursorType", symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4923
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4924 /* Dimensions, especially f->height, must be done via change_frame_size.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4925 Change will not be effected unless different from the current
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4926 f->height. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4927 width = f->width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4928 height = f->height;
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
4929 f->height = 0;
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
4930 SET_FRAME_WIDTH (f, 0);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4931 change_frame_size (f, height, width, 1, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4932
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4933 /* Tell the server what size and position, etc, we want,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4934 and how badly we want them. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4935 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4936 x_wm_set_size_hint (f, window_prompting, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4937 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4938
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4939 tem = x_get_arg (parms, Qunsplittable, 0, 0, boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4940 f->no_split = minibuffer_only || EQ (tem, Qt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4941
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4942 UNGCPRO;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4943
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4944 /* It is now ok to make the frame official
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4945 even if we get an error below.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4946 And the frame needs to be on Vframe_list
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4947 or making it visible won't work. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4948 Vframe_list = Fcons (frame, Vframe_list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4949
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4950 /* Now that the frame is official, it counts as a reference to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4951 its display. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4952 FRAME_W32_DISPLAY_INFO (f)->reference_count++;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4953
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4954 /* Make the window appear on the frame and enable display,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4955 unless the caller says not to. However, with explicit parent,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4956 Emacs 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
4957 if (! f->output_data.w32->explicit_parent)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4958 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4959 Lisp_Object visibility;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4960
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4961 visibility = x_get_arg (parms, Qvisibility, 0, 0, symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4962 if (EQ (visibility, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4963 visibility = Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4964
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4965 if (EQ (visibility, Qicon))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4966 x_iconify_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4967 else if (! NILP (visibility))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4968 x_make_frame_visible (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4969 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4970 /* Must have been Qnil. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4971 ;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4972 }
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 return unbind_to (count, frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4975 }
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 /* 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
4978 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
4979 know about that structure. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4980 Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4981 x_get_focus_frame (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4982 struct frame *frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4983 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4984 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4985 Lisp_Object xfocus;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4986 if (! dpyinfo->w32_focus_frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4987 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4988
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4989 XSETFRAME (xfocus, dpyinfo->w32_focus_frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4990 return xfocus;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4991 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4992
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4993 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
4994 "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
4995 (frame)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4996 Lisp_Object frame;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4997 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4998 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
4999 return Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5000 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5001
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5002
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5003 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
5004 int size, char* filename);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5005
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5006 struct font_info *
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5007 w32_load_system_font (f,fontname,size)
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5008 struct frame *f;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5009 char * fontname;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5010 int size;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5011 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5012 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
5013 Lisp_Object font_names;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5014
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5015 /* 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
5016 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
5017 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
5018 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
5019
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5020 if (!NILP (font_names))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5021 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5022 Lisp_Object tail;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5023 int i;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5024 #if 0 /* This code has nasty side effects that cause Emacs to crash. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5025
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5026 /* 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
5027 than loading another one. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5028 for (i = 0; i < dpyinfo->n_fonts; i++)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5029 for (tail = font_names; CONSP (tail); tail = XCONS (tail)->cdr)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5030 if (!strcmp (dpyinfo->font_table[i].name,
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5031 XSTRING (XCONS (tail)->car)->data)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5032 || !strcmp (dpyinfo->font_table[i].full_name,
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5033 XSTRING (XCONS (tail)->car)->data))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5034 return (dpyinfo->font_table + i);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5035 #endif
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5036 fontname = (char *) XSTRING (XCONS (font_names)->car)->data;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5037 }
24481
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
5038 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
5039 {
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5040 /* 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
5041 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
5042 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
5043 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
5044 listed or not. */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5045 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
5046 FARPROC enum_font_families_ex
24481
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
5047 = 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
5048 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
5049 return NULL;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5050 }
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5051
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5052 /* 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
5053 {
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5054 char *full_name, *encoding;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5055 XFontStruct *font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5056 struct font_info *fontp;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5057 LOGFONT lf;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5058 BOOL ok;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5059
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5060 if (!fontname || !x_to_w32_font (fontname, &lf))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5061 return (NULL);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5062
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5063 if (!*lf.lfFaceName)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5064 /* 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
5065 from CreateFontIndirect - this is not particularly
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5066 desirable, especially since CreateFontIndirect does not
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5067 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
5068 ended up with. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5069 return NULL;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5070
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5071 font = (XFontStruct *) xmalloc (sizeof (XFontStruct));
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5072
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5073 /* 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
5074 font->bdf = NULL;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5075
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5076 BLOCK_INPUT;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5077
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5078 font->hfont = CreateFontIndirect (&lf);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5079
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5080 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
5081 {
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5082 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
5083 }
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5084 else
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5085 {
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5086 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
5087 HANDLE oldobj;
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5088
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5089 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
5090 oldobj = SelectObject (hdc, font->hfont);
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5091 ok = GetTextMetrics (hdc, &font->tm);
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5092 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
5093 ReleaseDC (dpyinfo->root_window, hdc);
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5094
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5095 /* [andrewi, 25-Apr-99] A number of fixed pitch fonts,
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5096 eg. Courier New and perhaps others, report a max width which
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5097 is larger than the average character width, at least on some
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5098 NT systems (I don't understand why - my best guess is that it
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5099 results from installing the CJK language packs for NT4).
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5100 Unfortunately, this forces the redisplay code in dumpglyphs
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5101 to draw text character by character.
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5102
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5103 I don't like this hack, but it seems better to force the max
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5104 width to match the average width if the font is marked as
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5105 fixed pitch, for the sake of redisplay performance. */
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5106
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5107 if ((font->tm.tmPitchAndFamily & TMPF_FIXED_PITCH) == 0)
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5108 font->tm.tmMaxCharWidth = font->tm.tmAveCharWidth;
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5109 }
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5110
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5111 UNBLOCK_INPUT;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5112
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5113 if (!ok)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5114 {
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5115 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
5116 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
5117 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5118
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5119 /* Do we need to create the table? */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5120 if (dpyinfo->font_table_size == 0)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5121 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5122 dpyinfo->font_table_size = 16;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5123 dpyinfo->font_table
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5124 = (struct font_info *) xmalloc (dpyinfo->font_table_size
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5125 * sizeof (struct font_info));
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5126 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5127 /* Do we need to grow the table? */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5128 else if (dpyinfo->n_fonts
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5129 >= dpyinfo->font_table_size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5130 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5131 dpyinfo->font_table_size *= 2;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5132 dpyinfo->font_table
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5133 = (struct font_info *) xrealloc (dpyinfo->font_table,
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5134 (dpyinfo->font_table_size
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5135 * sizeof (struct font_info)));
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5136 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5137
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5138 fontp = dpyinfo->font_table + dpyinfo->n_fonts;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5139
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5140 /* 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
5141 BLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5142 fontp->font = font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5143 fontp->font_idx = dpyinfo->n_fonts;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5144 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
5145 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
5146
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5147 /* 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
5148 full_name = (char *)xmalloc (100);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5149 if (full_name && w32_to_x_font (&lf, full_name, 100))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5150 fontp->full_name = full_name;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5151 else
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5152 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5153 /* 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
5154 xfree (full_name);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5155 fontp->full_name = fontp->name;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5156 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5157
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5158 fontp->size = FONT_WIDTH (font);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5159 fontp->height = FONT_HEIGHT (font);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5160
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5161 /* 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
5162 code-points (0x20..0x7F or 0x2020..0x7F7F) of each charset to
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5163 the font code-points (0:0x20..0x7F, 1:0xA0..0xFF, 0:0x2020..0x7F7F,
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5164 the font code-points (0:0x20..0x7F, 1:0xA0..0xFF,
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5165 0:0x2020..0x7F7F, 1:0xA0A0..0xFFFF, 3:0x20A0..0x7FFF, or
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5166 2:0xA020..0xFF7F). For the moment, we don't know which charset
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5167 uses this font. So, we set informatoin in fontp->encoding[1]
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5168 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
5169 decided, set FONT_ENCODING_NOT_DECIDED. */
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5170
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5171 /* 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
5172 type FONT_ENCODING_NOT_DECIDED. */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5173 encoding = strrchr (fontp->name, '-');
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5174 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
5175 fontp->encoding[1] = 4;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5176 else
24692
a0a2521b783d (x_to_w32_charset): Fix typo: want to map all Japanese
Andrew Innes <andrewi@gnu.org>
parents: 24679
diff changeset
5177 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
5178
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5179 /* 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
5180 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
5181 fontp->baseline_offset = 0;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5182 fontp->relative_compose = 0;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5183 fontp->default_ascent = 0;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5184
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5185 UNBLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5186 dpyinfo->n_fonts++;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5187
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5188 return fontp;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5189 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5190 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5191
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5192 /* 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
5193 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
5194 If loading fails, return NULL. */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5195 struct font_info *
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5196 w32_load_font (f,fontname,size)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5197 struct frame *f;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5198 char * fontname;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5199 int size;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5200 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5201 Lisp_Object bdf_fonts;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5202 struct font_info *retval = NULL;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5203
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5204 bdf_fonts = w32_list_bdf_fonts (build_string (fontname));
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5205
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5206 while (!retval && CONSP (bdf_fonts))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5207 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5208 char *bdf_name, *bdf_file;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5209 Lisp_Object bdf_pair;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5210
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5211 bdf_name = XSTRING (XCONS (bdf_fonts)->car)->data;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5212 bdf_pair = Fassoc (XCONS (bdf_fonts)->car, Vw32_bdf_filename_alist);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5213 bdf_file = XSTRING (XCONS (bdf_pair)->cdr)->data;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5214
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5215 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
5216
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5217 bdf_fonts = XCONS (bdf_fonts)->cdr;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5218 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5219
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5220 if (retval)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5221 return retval;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5222
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5223 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
5224 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5225
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5226
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5227 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5228 w32_unload_font (dpyinfo, font)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5229 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5230 XFontStruct * font;
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 (font)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5233 {
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5234 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
5235
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5236 if (font->hfont) DeleteObject(font->hfont);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5237 xfree (font);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5238 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5239 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5240
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5241 /* The font conversion stuff between x and w32 */
13434
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 /* X font string is as follows (from faces.el)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5244 * (let ((- "[-?]")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5245 * (foundry "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5246 * (family "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5247 * (weight "\\(bold\\|demibold\\|medium\\)") ; 1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5248 * (weight\? "\\([^-]*\\)") ; 1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5249 * (slant "\\([ior]\\)") ; 2
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5250 * (slant\? "\\([^-]?\\)") ; 2
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5251 * (swidth "\\([^-]*\\)") ; 3
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5252 * (adstyle "[^-]*") ; 4
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5253 * (pixelsize "[0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5254 * (pointsize "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5255 * (resx "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5256 * (resy "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5257 * (spacing "[cmp?*]")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5258 * (avgwidth "[0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5259 * (registry "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5260 * (encoding "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5261 * )
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5262 * (setq x-font-regexp
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5263 * (concat "\\`\\*?[-?*]"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5264 * foundry - family - weight\? - slant\? - swidth - adstyle -
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5265 * pixelsize - pointsize - resx - resy - spacing - registry -
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5266 * encoding "[-?*]\\*?\\'"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5267 * ))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5268 * (setq x-font-regexp-head
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5269 * (concat "\\`[-?*]" foundry - family - weight\? - slant\?
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5270 * "\\([-*?]\\|\\'\\)"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5271 * (setq x-font-regexp-slant (concat - slant -))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5272 * (setq x-font-regexp-weight (concat - weight -))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5273 * nil)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5274 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5275
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5276 #define FONT_START "[-?]"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5277 #define FONT_FOUNDRY "[^-]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5278 #define FONT_FAMILY "\\([^-]+\\)" /* 1 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5279 #define FONT_WEIGHT "\\(bold\\|demibold\\|medium\\)" /* 2 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5280 #define FONT_WEIGHT_Q "\\([^-]*\\)" /* 2 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5281 #define FONT_SLANT "\\([ior]\\)" /* 3 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5282 #define FONT_SLANT_Q "\\([^-]?\\)" /* 3 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5283 #define FONT_SWIDTH "\\([^-]*\\)" /* 4 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5284 #define FONT_ADSTYLE "[^-]*"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5285 #define FONT_PIXELSIZE "[^-]*"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5286 #define FONT_POINTSIZE "\\([0-9][0-9]+\\|\\*\\)" /* 5 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5287 #define FONT_RESX "[0-9][0-9]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5288 #define FONT_RESY "[0-9][0-9]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5289 #define FONT_SPACING "[cmp?*]"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5290 #define FONT_AVGWIDTH "[0-9]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5291 #define FONT_REGISTRY "[^-]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5292 #define FONT_ENCODING "[^-]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5293
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5294 #define FONT_REGEXP ("\\`\\*?[-?*]" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5295 FONT_FOUNDRY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5296 FONT_FAMILY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5297 FONT_WEIGHT_Q "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5298 FONT_SLANT_Q "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5299 FONT_SWIDTH "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5300 FONT_ADSTYLE "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5301 FONT_PIXELSIZE "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5302 FONT_POINTSIZE "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5303 "[-?*]\\|\\'")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5304
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5305 #define FONT_REGEXP_HEAD ("\\`[-?*]" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5306 FONT_FOUNDRY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5307 FONT_FAMILY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5308 FONT_WEIGHT_Q "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5309 FONT_SLANT_Q \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5310 "\\([-*?]\\|\\'\\)")
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 #define FONT_REGEXP_SLANT "-" FONT_SLANT "-"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5313 #define FONT_REGEXP_WEIGHT "-" FONT_WEIGHT "-"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5314
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5315 LONG
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5316 x_to_w32_weight (lpw)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5317 char * lpw;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5318 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5319 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
5320
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5321 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
5322 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
5323 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
5324 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
5325 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
5326 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
5327 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
5328 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
5329 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
5330 else if (stricmp (lpw,"thin") == 0) return FW_THIN;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5331 else
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5332 return FW_DONTCARE;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5333 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5334
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5335
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5336 char *
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5337 w32_to_x_weight (fnweight)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5338 int fnweight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5339 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5340 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
5341 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
5342 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
5343 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
5344 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
5345 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
5346 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
5347 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
5348 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
5349 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5350 return "*";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5351 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5352
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5353 LONG
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5354 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
5355 char * lpcs;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5356 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5357 if (!lpcs) return (0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5358
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5359 if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET;
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5360 else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5361 else if (stricmp (lpcs, "ms-symbol") == 0) return SYMBOL_CHARSET;
24692
a0a2521b783d (x_to_w32_charset): Fix typo: want to map all Japanese
Andrew Innes <andrewi@gnu.org>
parents: 24679
diff changeset
5362 /* Map all Japanese charsets to the Windows Shift-JIS charset. */
a0a2521b783d (x_to_w32_charset): Fix typo: want to map all Japanese
Andrew Innes <andrewi@gnu.org>
parents: 24679
diff changeset
5363 else if (strnicmp (lpcs, "jis", 3) == 0) return SHIFTJIS_CHARSET;
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5364 /* Map all GB charsets to the Windows GB2312 charset. */
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5365 else if (strnicmp (lpcs, "gb2312", 6) == 0) return GB2312_CHARSET;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5366 /* Map all Big5 charsets to the Windows Big5 charset. */
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5367 else if (strnicmp (lpcs, "big5", 4) == 0) return CHINESEBIG5_CHARSET;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5368 else if (stricmp (lpcs, "ksc5601.1987") == 0) return HANGEUL_CHARSET;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5369 else if (stricmp (lpcs, "ms-oem") == 0) return OEM_CHARSET;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5370
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5371 #ifdef EASTEUROPE_CHARSET
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5372 else if (stricmp (lpcs, "iso8859-2") == 0) return EASTEUROPE_CHARSET;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5373 else if (stricmp (lpcs, "iso8859-3") == 0) return TURKISH_CHARSET;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5374 else if (stricmp (lpcs, "iso8859-4") == 0) return BALTIC_CHARSET;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5375 else if (stricmp (lpcs, "iso8859-5") == 0) return RUSSIAN_CHARSET;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5376 else if (stricmp (lpcs, "koi8") == 0) return RUSSIAN_CHARSET;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5377 else if (stricmp (lpcs, "iso8859-6") == 0) return ARABIC_CHARSET;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5378 else if (stricmp (lpcs, "iso8859-7") == 0) return GREEK_CHARSET;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5379 else if (stricmp (lpcs, "iso8859-8") == 0) return HEBREW_CHARSET;
24130
3a271e4c5332 (x_to_w32_charset): Add iso8859-9.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23950
diff changeset
5380 else if (stricmp (lpcs, "iso8859-9") == 0) return TURKISH_CHARSET;
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5381 #ifndef VIETNAMESE_CHARSET
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5382 #define VIETNAMESE_CHARSET 163
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5383 #endif
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5384 /* Map all Viscii charsets to the Windows Vietnamese charset. */
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5385 else if (strnicmp (lpcs, "viscii", 6) == 0) return VIETNAMESE_CHARSET;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5386 else if (strnicmp (lpcs, "vscii", 5) == 0) return VIETNAMESE_CHARSET;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5387 /* Map all TIS charsets to the Windows Thai charset. */
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5388 else if (strnicmp (lpcs, "tis620", 6) == 0) return THAI_CHARSET;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5389 else if (stricmp (lpcs, "mac") == 0) return MAC_CHARSET;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5390 else if (stricmp (lpcs, "ksc5601.1992") == 0) return JOHAB_CHARSET;
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5391 /* For backwards compatibility with previous 20.4 pretests, map
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5392 non-specific KSC charsets to the Windows Hangeul charset. */
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
5393 else if (strnicmp (lpcs, "ksc5601", 7) == 0) return HANGEUL_CHARSET;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5394 else if (stricmp (lpcs, "johab") == 0) return JOHAB_CHARSET;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5395 #endif
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5396
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5397 #ifdef UNICODE_CHARSET
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5398 else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET;
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5399 else if (stricmp (lpcs, "unicode") == 0) return UNICODE_CHARSET;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5400 #endif
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5401 else if (lpcs[0] == '#') return atoi (lpcs + 1);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5402 else
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5403 return DEFAULT_CHARSET;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5404 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5405
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5406 char *
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5407 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
5408 int fncharset;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5409 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5410 static char buf[16];
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5411
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5412 switch (fncharset)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5413 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5414 /* ansi is considered iso8859-1, as most modern ansi fonts are. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5415 case ANSI_CHARSET: return "iso8859-1";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5416 case DEFAULT_CHARSET: return "ascii-*";
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5417 case SYMBOL_CHARSET: return "ms-symbol";
24130
3a271e4c5332 (x_to_w32_charset): Add iso8859-9.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23950
diff changeset
5418 case SHIFTJIS_CHARSET: return "jisx0208-sjis";
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5419 case HANGEUL_CHARSET: return "ksc5601.1987-*";
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5420 case GB2312_CHARSET: return "gb2312-*";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5421 case CHINESEBIG5_CHARSET: return "big5-*";
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5422 case OEM_CHARSET: return "ms-oem";
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5423
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5424 /* 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
5425 character sets. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5426 #ifdef EASTEUROPE_CHARSET
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5427 case EASTEUROPE_CHARSET: return "iso8859-2";
24130
3a271e4c5332 (x_to_w32_charset): Add iso8859-9.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23950
diff changeset
5428 case TURKISH_CHARSET: return "iso8859-9";
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5429 case BALTIC_CHARSET: return "iso8859-4";
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5430
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5431 /* W95 with international support but not IE4 often has the
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5432 KOI8-R codepage but not ISO8859-5. */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5433 case RUSSIAN_CHARSET:
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5434 if (!IsValidCodePage(28595) && IsValidCodePage(20886))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5435 return "koi8-r";
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5436 else
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5437 return "iso8859-5";
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5438 case ARABIC_CHARSET: return "iso8859-6";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5439 case GREEK_CHARSET: return "iso8859-7";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5440 case HEBREW_CHARSET: return "iso8859-8";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5441 case VIETNAMESE_CHARSET: return "viscii1.1-*";
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5442 case THAI_CHARSET: return "tis620-*";
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5443 case MAC_CHARSET: return "mac-*";
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5444 case JOHAB_CHARSET: return "ksc5601.1992-*";
24130
3a271e4c5332 (x_to_w32_charset): Add iso8859-9.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23950
diff changeset
5445
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5446 #endif
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5447
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5448 #ifdef UNICODE_CHARSET
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5449 case UNICODE_CHARSET: return "iso10646-unicode";
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5450 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5451 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5452 /* Encode numerical value of unknown charset. */
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5453 sprintf (buf, "*-#%u", fncharset);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5454 return buf;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5455 }
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 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5458 w32_to_x_font (lplogfont, lpxstr, len)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5459 LOGFONT * lplogfont;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5460 char * lpxstr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5461 int len;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5462 {
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5463 char *fontname;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5464 char height_pixels[8];
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5465 char height_dpi[8];
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5466 char width_pixels[8];
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5467 char *fontname_dash;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5468 int display_resy = one_w32_display_info.height_in;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5469 int display_resx = one_w32_display_info.width_in;
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5470 int bufsz;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5471 struct coding_system coding;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5472
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5473 if (!lpxstr) abort ();
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5474
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5475 if (!lplogfont)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5476 return FALSE;
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5477
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5478 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
5479 &coding);
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5480 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
5481 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
5482
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5483 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
5484 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
5485 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
5486 *(fontname + coding.produced) = '\0';
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5487
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5488 /* 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
5489 misinterpreted. */
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5490 fontname_dash = fontname;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5491 while (fontname_dash = strchr (fontname_dash, '-'))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5492 *fontname_dash = '_';
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5493
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5494 if (lplogfont->lfHeight)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5495 {
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5496 sprintf (height_pixels, "%u", abs (lplogfont->lfHeight));
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5497 sprintf (height_dpi, "%u",
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5498 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
5499 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5500 else
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5501 {
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5502 strcpy (height_pixels, "*");
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5503 strcpy (height_dpi, "*");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5504 }
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5505 if (lplogfont->lfWidth)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5506 sprintf (width_pixels, "%u", lplogfont->lfWidth * 10);
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5507 else
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5508 strcpy (width_pixels, "*");
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5509
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5510 _snprintf (lpxstr, len - 1,
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5511 "-*-%s-%s-%c-*-*-%s-%s-%d-%d-%c-%s-%s",
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5512 /* foundry */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5513 fontname, /* family */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5514 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
5515 lplogfont->lfItalic?'i':'r', /* slant */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5516 /* setwidth name */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5517 /* add style name */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5518 height_pixels, /* pixel size */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5519 height_dpi, /* point size */
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5520 display_resx, /* resx */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5521 display_resy, /* resy */
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5522 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5523 ? 'p' : 'c', /* spacing */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5524 width_pixels, /* avg width */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5525 w32_to_x_charset (lplogfont->lfCharSet) /* charset registry
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5526 and encoding*/
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5527 );
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5528
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5529 lpxstr[len - 1] = 0; /* just to be sure */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5530 return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5531 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5532
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5533 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5534 x_to_w32_font (lpxstr, lplogfont)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5535 char * lpxstr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5536 LOGFONT * lplogfont;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5537 {
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5538 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
5539
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5540 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
5541
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5542 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
5543
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5544 /* 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
5545 #if 1
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5546 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5547 lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5548 lplogfont->lfQuality = DEFAULT_QUALITY;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5549 #else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5550 /* go for maximum quality */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5551 lplogfont->lfOutPrecision = OUT_STROKE_PRECIS;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5552 lplogfont->lfClipPrecision = CLIP_STROKE_PRECIS;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5553 lplogfont->lfQuality = PROOF_QUALITY;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5554 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5555
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5556 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
5557 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
5558 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
5559
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5560 if (!lpxstr)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5561 return FALSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5562
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5563 /* 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
5564 * 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
5565 * format:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5566 * "<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
5567 */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5568
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5569 if (*lpxstr == '-')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5570 {
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5571 int fields, tem;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5572 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
5573 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
5574 char * encoding;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5575 int dpi = one_w32_display_info.height_in;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5576
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5577 fields = sscanf (lpxstr,
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5578 "-%*[^-]-%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
5579 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
5580 if (fields == EOF) return (FALSE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5581
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5582 if (fields > 0 && name[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5583 {
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
5584 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
5585 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
5586
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5587 setup_coding_system
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5588 (Fcheck_coding_system (Vw32_system_coding_system), &coding);
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
5589 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
5590 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
5591 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
5592 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
5593 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
5594 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
5595 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
5596 strcpy (lplogfont->lfFaceName, buf);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5597 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5598 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5599 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5600 lplogfont->lfFaceName[0] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5601 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5602
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5603 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5604
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5605 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
5606
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5607 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5608
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5609 if (!NILP (Vw32_enable_italics))
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5610 lplogfont->lfItalic = (fields > 0 && slant == 'i');
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5611
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5612 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5613
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5614 if (fields > 0 && pixels[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5615 lplogfont->lfHeight = atoi (pixels);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5616
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5617 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5618 fields--;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5619 if (fields > 0 && resy[0] != '*')
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5620 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5621 tem = atoi (pixels);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5622 if (tem > 0) dpi = tem;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5623 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5624
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5625 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
5626 lplogfont->lfHeight = atoi (height) * dpi / 720;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5627
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5628 if (fields > 0)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5629 lplogfont->lfPitchAndFamily =
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5630 (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
5631
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5632 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5633
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5634 if (fields > 0 && width[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5635 lplogfont->lfWidth = atoi (width) / 10;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5636
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5637 fields--;
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 /* Strip the trailing '-' if present. (it shouldn't be, as it
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5640 fails the test against xlfn-tight-regexp in fontset.el). */
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5641 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5642 int len = strlen (remainder);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5643 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
5644 remainder[len-1] = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5645 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5646 encoding = remainder;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5647 if (strncmp (encoding, "*-", 2) == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5648 encoding += 2;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5649 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
5650 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5651 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5652 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5653 int fields;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5654 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
5655
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5656 fields = sscanf (lpxstr,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5657 "%99[^:]:%9[^:]:%9[^:]:%19s",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5658 name, height, width, weight);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5659
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5660 if (fields == EOF) return (FALSE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5661
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5662 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5663 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5664 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
5665 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
5666 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5667 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5668 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5669 lplogfont->lfFaceName[0] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5670 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5671
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5672 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5673
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5674 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5675 lplogfont->lfHeight = atoi (height);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5676
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5677 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5678
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5679 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5680 lplogfont->lfWidth = atoi (width);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5681
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5682 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5683
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5684 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
5685 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5686
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5687 /* 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
5688 lplogfont->lfHeight = - abs (lplogfont->lfHeight);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5689
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5690 return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5691 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5692
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5693 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5694 w32_font_match (lpszfont1, lpszfont2)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5695 char * lpszfont1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5696 char * lpszfont2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5697 {
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5698 char * s1 = lpszfont1, *e1, *w1;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5699 char * s2 = lpszfont2, *e2, *w2;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5700
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5701 if (s1 == NULL || s2 == NULL) return (FALSE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5702
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5703 if (*s1 == '-') s1++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5704 if (*s2 == '-') s2++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5705
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5706 while (1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5707 {
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5708 int len1, len2, len3=0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5709
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5710 e1 = strchr (s1, '-');
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5711 e2 = strchr (s2, '-');
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5712 w1 = strchr (s1, '*');
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5713 w2 = strchr (s2, '*');
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5714
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5715 if (e1 == NULL)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5716 len1 = strlen (s1);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5717 else
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5718 len1 = e1 - s1;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5719 if (e2 == NULL)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5720 len2 = strlen (s1);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5721 else
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5722 len2 = e2 - s2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5723
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5724 if (w1 && w1 < e1)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5725 len3 = w1 - s1;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5726 if (w2 && w2 < e2 && ( len3 == 0 || (w2 - s2) < len3))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5727 len3 = w2 - s2;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5728
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5729 /* Whole field is not a wildcard, and ...*/
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5730 if (*s1 != '*' && *s2 != '*' && *s1 != '-' && *s2 != '-'
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5731 /* Lengths are different and there are no wildcards, or ... */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5732 && ((len1 != len2 && len3 == 0) ||
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5733 /* strings don't match up until first wildcard or end. */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5734 strnicmp (s1, s2, len3 > 0 ? len3 : len1) != 0))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5735 return (FALSE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5736
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5737 if (e1 == NULL || e2 == NULL)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5738 return (TRUE);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5739
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5740 s1 = e1 + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5741 s2 = e2 + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5742 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5743 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5744
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5745 /* 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
5746 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
5747 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
5748 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
5749 fall back on.
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5750
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5751 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
5752 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
5753 each family. */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5754
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5755 typedef struct enumfont_t
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5756 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5757 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5758 int numFonts;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5759 LOGFONT logfont;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5760 XFontStruct *size_ref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5761 Lisp_Object *pattern;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5762 Lisp_Object *tail;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5763 } enumfont_t;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5764
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5765 int CALLBACK
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5766 enum_font_cb2 (lplf, lptm, FontType, lpef)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5767 ENUMLOGFONT * lplf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5768 NEWTEXTMETRIC * lptm;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5769 int FontType;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5770 enumfont_t * lpef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5771 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
5772 if (lplf->elfLogFont.lfStrikeOut || lplf->elfLogFont.lfUnderline)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5773 return (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5774
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5775 /* 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
5776 if (lpef->logfont.lfCharSet != DEFAULT_CHARSET &&
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5777 lplf->elfLogFont.lfCharSet != lpef->logfont.lfCharSet)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5778 return (1);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5779
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5780 /* We want all fonts cached, so don't compare sizes just yet */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5781 /* if (!lpef->size_ref || lptm->tmMaxCharWidth == FONT_WIDTH (lpef->size_ref)) */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5782 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5783 char buf[100];
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5784 Lisp_Object width = Qnil;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5785
21896
ff66bfc5d801 (enum_font_cb2): Only ignore raster fonts when
Geoff Voelker <voelker@cs.washington.edu>
parents: 21884
diff changeset
5786 if (!NILP (*(lpef->pattern)) && FontType != RASTER_FONTTYPE)
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5787 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5788 /* Scalable fonts are as big as you want them to be. */
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5789 lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight;
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5790 lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth;
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5791 }
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5792 /* 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
5793 else (ie character height, not cell height). */
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5794 else if (lplf->elfLogFont.lfHeight > 0)
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5795 lplf->elfLogFont.lfHeight = lptm->tmInternalLeading - lptm->tmHeight;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5796
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5797 /* The MaxCharWidth is not valid at this stage for scalable fonts. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5798 if (FontType == RASTER_FONTTYPE)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5799 width = make_number (lptm->tmMaxCharWidth);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5800
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5801 if (!w32_to_x_font (&(lplf->elfLogFont), buf, 100))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5802 return (0);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5803
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5804 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
5805 || w32_font_match (buf, XSTRING (*(lpef->pattern))->data))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5806 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5807 *lpef->tail = Fcons (Fcons (build_string (buf), width), Qnil);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5808 lpef->tail = &(XCONS (*lpef->tail)->cdr);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5809 lpef->numFonts++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5810 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5811 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5812
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5813 return (1);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5816 int CALLBACK
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5817 enum_font_cb1 (lplf, lptm, FontType, lpef)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5818 ENUMLOGFONT * lplf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5819 NEWTEXTMETRIC * lptm;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5820 int FontType;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5821 enumfont_t * lpef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5822 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5823 return EnumFontFamilies (lpef->hdc,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5824 lplf->elfLogFont.lfFaceName,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5825 (FONTENUMPROC) enum_font_cb2,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5826 (LPARAM) lpef);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5827 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5828
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5829
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5830 int CALLBACK
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5831 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
5832 ENUMLOGFONTEX * lplf;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5833 NEWTEXTMETRICEX * lptm;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5834 int font_type;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5835 enumfont_t * lpef;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5836 {
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5837 /* 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
5838 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
5839 enumerated seperately. */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5840 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
5841 font_type, lpef);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5842 }
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5843
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5844 int CALLBACK
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5845 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
5846 ENUMLOGFONTEX * lplf;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5847 NEWTEXTMETRICEX * lptm;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5848 int font_type;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5849 enumfont_t * lpef;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5850 {
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5851 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
5852 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
5853 = GetProcAddress ( gdi32, "EnumFontFamiliesExA");
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5854 /* 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
5855 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
5856 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
5857 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
5858 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
5859 &lplf->elfLogFont,
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5860 (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
5861 (LPARAM) lpef, 0);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5862 }
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5863
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5864 /* 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
5865 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
5866
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5867 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
5868 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5869 char *fontname, *ptnstr;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5870 Lisp_Object list, tem, newlist = Qnil;
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
5871 int n_fonts = 0;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5872
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5873 list = Vw32_bdf_filename_alist;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5874 ptnstr = XSTRING (pattern)->data;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5875
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5876 for ( ; CONSP (list); list = XCONS (list)->cdr)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5877 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5878 tem = XCONS (list)->car;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5879 if (CONSP (tem))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5880 fontname = XSTRING (XCONS (tem)->car)->data;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5881 else if (STRINGP (tem))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5882 fontname = XSTRING (tem)->data;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5883 else
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5884 continue;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5885
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5886 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
5887 {
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5888 newlist = Fcons (XCONS (tem)->car, newlist);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5889 n_fonts++;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5890 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
5891 break;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5892 }
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5893 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5894
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5895 return newlist;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5896 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5897
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5898 Lisp_Object w32_list_synthesized_fonts (FRAME_PTR f, Lisp_Object pattern,
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5899 int size, int max_names);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5900
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5901 /* 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
5902 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
5903 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
5904 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
5905 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
5906 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
5907
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5908 Lisp_Object
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5909 w32_list_fonts (FRAME_PTR f, Lisp_Object pattern, int size, int maxnames )
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5910 {
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5911 Lisp_Object patterns, key, tem, tpat;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5912 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
5913 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
5914 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
5915
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5916 patterns = Fassoc (pattern, Valternate_fontname_alist);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5917 if (NILP (patterns))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5918 patterns = Fcons (pattern, Qnil);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5919
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5920 for (; CONSP (patterns); patterns = XCONS (patterns)->cdr)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5921 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5922 enumfont_t ef;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5923
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5924 tpat = XCONS (patterns)->car;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5925
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5926 /* 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
5927 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
5928 ((PATTERN (FONTNAME . WIDTH) ...) ...)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5929 */
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5930 if (tem = XCONS (dpyinfo->name_list_element)->cdr,
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5931 !NILP (list = Fassoc (tpat, tem)))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5932 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5933 list = Fcdr_safe (list);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5934 /* 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
5935 goto label_cached;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5936 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5937
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5938 BLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5939 /* 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
5940 list = Qnil;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5941 ef.pattern = &tpat;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5942 ef.tail = &list;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5943 ef.numFonts = 0;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5944
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5945 /* 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
5946 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
5947 older versions of NT that don't support the 'Ex function. */
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5948 x_to_w32_font (STRINGP (tpat) ? XSTRING (tpat)->data :
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5949 NULL, &ef.logfont);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5950 {
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5951 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
5952 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
5953 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
5954 = GetProcAddress ( gdi32, "EnumFontFamiliesExA");
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5955
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5956 /* 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
5957 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
5958 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
5959 /* 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
5960 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
5961 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
5962
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5963 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
5964
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5965 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
5966 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
5967 &font_match_pattern,
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5968 (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
5969 (LPARAM) &ef, 0);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5970 else
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5971 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
5972 (LPARAM)&ef);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5973
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5974 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
5975 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5976
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5977 UNBLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5978
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5979 /* 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
5980 Store that in the font cache for the display. */
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5981 XCONS (dpyinfo->name_list_element)->cdr
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5982 = Fcons (Fcons (tpat, list),
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5983 XCONS (dpyinfo->name_list_element)->cdr);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5984
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5985 label_cached:
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5986 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
5987
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5988 newlist = second_best = Qnil;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5989
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5990 /* Make a list of the fonts that have the right width. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5991 for (; CONSP (list); list = XCONS (list)->cdr)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5992 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5993 int found_size;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5994 tem = XCONS (list)->car;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5995
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5996 if (!CONSP (tem))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5997 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5998 if (NILP (XCONS (tem)->car))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5999 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6000 if (!size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6001 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6002 newlist = Fcons (XCONS (tem)->car, newlist);
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6003 n_fonts++;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6004 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
6005 break;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6006 else
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6007 continue;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6008 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6009 if (!INTEGERP (XCONS (tem)->cdr))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6010 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6011 /* 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
6012 load it and try GetTextMetrics. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6013 W32FontStruct thisinfo;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6014 LOGFONT lf;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6015 HDC hdc;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6016 HANDLE oldobj;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6017
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6018 if (!x_to_w32_font (XSTRING (XCONS (tem)->car)->data, &lf))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6019 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6020
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6021 BLOCK_INPUT;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6022 thisinfo.bdf = NULL;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6023 thisinfo.hfont = CreateFontIndirect (&lf);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6024 if (thisinfo.hfont == NULL)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6025 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6026
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6027 hdc = GetDC (dpyinfo->root_window);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6028 oldobj = SelectObject (hdc, thisinfo.hfont);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6029 if (GetTextMetrics (hdc, &thisinfo.tm))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6030 XCONS (tem)->cdr = make_number (FONT_WIDTH (&thisinfo));
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6031 else
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6032 XCONS (tem)->cdr = make_number (0);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6033 SelectObject (hdc, oldobj);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6034 ReleaseDC (dpyinfo->root_window, hdc);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6035 DeleteObject(thisinfo.hfont);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6036 UNBLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6037 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6038 found_size = XINT (XCONS (tem)->cdr);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6039 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
6040 {
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6041 newlist = Fcons (XCONS (tem)->car, newlist);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6042 n_fonts++;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6043 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
6044 break;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6045 }
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6046 /* 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
6047 no exact match is found. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6048 else if (found_size > 0)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6049 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6050 if (NILP (second_best))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6051 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
6052
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6053 else if (found_size < size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6054 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6055 if (XINT (XCONS (second_best)->cdr) > size
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6056 || XINT (XCONS (second_best)->cdr) < found_size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6057 second_best = tem;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6058 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6059 else
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6060 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6061 if (XINT (XCONS (second_best)->cdr) > size
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6062 && XINT (XCONS (second_best)->cdr) >
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6063 found_size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6064 second_best = tem;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6065 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6066 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6067 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6068
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6069 if (!NILP (newlist))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6070 break;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6071 else if (!NILP (second_best))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6072 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6073 newlist = Fcons (XCONS (second_best)->car, Qnil);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6074 break;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6075 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6076 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6077
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6078 /* 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
6079 if (n_fonts < maxnames)
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6080 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6081 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
6082 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
6083 combined[1] = newlist;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6084 newlist = Fnconc(2, combined);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6085 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6086
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6087 /* 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
6088 able to synthesize it from a different style. */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6089 if (NILP (newlist) && !NILP (Vw32_enable_italics))
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6090 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
6091
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6092 return newlist;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6093 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6094
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6095 Lisp_Object
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6096 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
6097 FRAME_PTR f;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6098 Lisp_Object pattern;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6099 int size;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6100 int max_names;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6101 {
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6102 int fields;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6103 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
6104 char style[20], slant;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6105 Lisp_Object matches, match, tem, synthed_matches = Qnil;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6106
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6107 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
6108
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6109 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
6110 /* 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
6111 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
6112
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6113 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
6114 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
6115 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
6116 return Qnil;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6117
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6118 /* 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
6119 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
6120 if (*style == '*' && slant == '*')
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6121 return Qnil;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6122
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6123 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
6124
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6125 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
6126
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6127 for ( ; CONSP (matches); matches = XCONS (matches)->cdr)
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6128 {
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6129 tem = XCONS (matches)->car;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6130 if (!STRINGP (tem))
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6131 continue;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6132
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6133 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
6134 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
6135 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
6136 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
6137 continue;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6138
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6139 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
6140 slant, pattn_part2);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6141
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6142 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
6143 synthed_matches);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6144 }
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6145
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6146 return synthed_matches;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6147 }
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6148
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6149
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6150 /* 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
6151 struct font_info *
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6152 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
6153 FRAME_PTR f;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6154 int font_idx;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6155 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6156 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
6157 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6158
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6159
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6160 struct font_info*
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6161 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
6162 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6163 int i;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6164 struct font_info *pfi;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6165
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6166 pfi = FRAME_W32_FONT_TABLE (f);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6167
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6168 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
6169 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6170 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
6171 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6172
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6173 return NULL;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6174 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6175
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6176 /* 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
6177 `encoder' of the structure. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6178
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6179 void
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6180 w32_find_ccl_program (fontp)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6181 struct font_info *fontp;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6182 {
25069
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6183 Lisp_Object list, elt;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6184
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6185 for (list = Vfont_ccl_encoder_alist; CONSP (list); list = XCONS (list)->cdr)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6186 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6187 elt = XCONS (list)->car;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6188 if (CONSP (elt)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6189 && STRINGP (XCONS (elt)->car)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6190 && (fast_c_string_match_ignore_case (XCONS (elt)->car, fontp->name)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6191 >= 0))
25069
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6192 break;
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6193 }
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6194 if (! NILP (list))
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6195 {
25084
d89aa269255d (w32_find_ccl_program): Add casting.
Kenichi Handa <handa@m17n.org>
parents: 25069
diff changeset
6196 struct ccl_program *ccl
d89aa269255d (w32_find_ccl_program): Add casting.
Kenichi Handa <handa@m17n.org>
parents: 25069
diff changeset
6197 = (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
6198
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6199 if (setup_ccl_program (ccl, XCONS (elt)->cdr) < 0)
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6200 xfree (ccl);
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6201 else
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6202 fontp->font_encoder = ccl;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6203 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6204 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6205
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6206
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6207 #if 1
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6208 #include "x-list-font.c"
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6209 #else
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
6210 DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 4, 0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6211 "Return a list of the names of available fonts matching PATTERN.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6212 If optional arguments FACE and FRAME are specified, return only fonts\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6213 the same size as FACE on FRAME.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6214 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6215 PATTERN is a string, perhaps with wildcard characters;\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6216 the * character matches any substring, and\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6217 the ? character matches any single character.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6218 PATTERN is case-insensitive.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6219 FACE is a face name--a symbol.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6220 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6221 The return value is a list of strings, suitable as arguments to\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6222 set-face-font.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6223 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6224 Fonts Emacs can't use (i.e. proportional fonts) may or may not be excluded\n\
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
6225 even if they match PATTERN and FACE.\n\
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
6226 \n\
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
6227 The optional fourth argument MAXIMUM sets a limit on how many\n\
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
6228 fonts to match. The first MAXIMUM fonts are reported.")
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
6229 (pattern, face, frame, maximum)
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
6230 Lisp_Object pattern, face, frame, maximum;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6231 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6232 int num_fonts;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6233 char **names;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6234 XFontStruct *info;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6235 XFontStruct *size_ref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6236 Lisp_Object namelist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6237 Lisp_Object list;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6238 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6239 enumfont_t ef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6240
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6241 CHECK_STRING (pattern, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6242 if (!NILP (face))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6243 CHECK_SYMBOL (face, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6244
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6245 f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6246
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6247 /* Determine the width standard for comparison with the fonts we find. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6248
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6249 if (NILP (face))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6250 size_ref = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6251 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6252 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6253 int face_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6254
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6255 /* Don't die if we get called with a terminal frame. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6256 if (! FRAME_W32_P (f))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6257 error ("non-w32 frame used in `x-list-fonts'");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6258
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6259 face_id = face_name_id_number (f, face);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6260
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6261 if (face_id < 0 || face_id >= FRAME_N_PARAM_FACES (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6262 || FRAME_PARAM_FACES (f) [face_id] == 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6263 size_ref = f->output_data.w32->font;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6264 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6265 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6266 size_ref = FRAME_PARAM_FACES (f) [face_id]->font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6267 if (size_ref == (XFontStruct *) (~0))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6268 size_ref = f->output_data.w32->font;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6269 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6270 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6271
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6272 /* See if we cached the result for this particular query. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6273 list = Fassoc (pattern,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6274 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6275
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6276 /* We have info in the cache for this PATTERN. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6277 if (!NILP (list))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6278 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6279 Lisp_Object tem, newlist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6280
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6281 /* We have info about this pattern. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6282 list = XCONS (list)->cdr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6283
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6284 if (size_ref == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6285 return list;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6286
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6287 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6288
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6289 /* Filter the cached info and return just the fonts that match FACE. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6290 newlist = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6291 for (tem = list; CONSP (tem); tem = XCONS (tem)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6292 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6293 struct font_info *fontinf;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6294 XFontStruct *thisinfo = NULL;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6295
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6296 fontinf = w32_load_font (f, XSTRING (XCONS (tem)->car)->data, 0);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6297 if (fontinf)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6298 thisinfo = (XFontStruct *)fontinf->font;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6299 if (thisinfo && same_size_fonts (thisinfo, size_ref))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6300 newlist = Fcons (XCONS (tem)->car, newlist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6301
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6302 w32_unload_font (FRAME_W32_DISPLAY_INFO (f), thisinfo);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6303 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6304
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6305 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6306
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6307 return newlist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6308 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6309
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6310 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6311
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6312 namelist = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6313 ef.pattern = &pattern;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6314 ef.tail &namelist;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6315 ef.numFonts = 0;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6316 x_to_w32_font (STRINGP (pattern) ? XSTRING (pattern)->data : NULL, &ef.logfont);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6317
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6318 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6319 ef.hdc = GetDC (FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6320
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6321 EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1, (LPARAM)&ef);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6322
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6323 ReleaseDC (FRAME_W32_WINDOW (f), ef.hdc);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6324 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6325
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6326 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6327
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6328 if (ef.numFonts)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6329 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6330 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6331 Lisp_Object cur;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6332
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6333 /* Make a list of all the fonts we got back.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6334 Store that in the font cache for the display. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6335 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6336 = Fcons (Fcons (pattern, namelist),
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6337 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6338
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6339 /* Make a list of the fonts that have the right width. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6340 list = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6341 cur=namelist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6342 for (i = 0; i < ef.numFonts; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6343 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6344 int keeper;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6345
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6346 if (!size_ref)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6347 keeper = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6348 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6349 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6350 struct font_info *fontinf;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6351 XFontStruct *thisinfo = NULL;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6352
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6353 BLOCK_INPUT;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6354 fontinf = w32_load_font (f, XSTRING (Fcar (cur))->data, 0);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6355 if (fontinf)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6356 thisinfo = (XFontStruct *)fontinf->font;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6357
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6358 keeper = thisinfo && same_size_fonts (thisinfo, size_ref);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6359
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6360 w32_unload_font (FRAME_W32_DISPLAY_INFO (f), thisinfo);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6361
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6362 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6363 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6364 if (keeper)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6365 list = Fcons (build_string (XSTRING (Fcar (cur))->data), list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6366
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6367 cur = Fcdr (cur);
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 list = Fnreverse (list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6370 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6371
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6372 return list;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6373 }
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6374 #endif
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6375
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6376 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
6377 1, 1, 0,
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6378 "Return a list of BDF fonts in DIR, suitable for appending to\n\
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6379 w32-bdf-filename-alist. Fonts which do not contain an xfld description\n\
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6380 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
6381 (directory)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6382 Lisp_Object directory;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6383 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6384 Lisp_Object list = Qnil;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6385 struct gcpro gcpro1, gcpro2;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6386
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6387 if (!CONSP (directory))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6388 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
6389
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6390 for ( ; CONSP (directory); directory = XCONS (directory)->cdr)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6391 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6392 Lisp_Object pair[2];
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6393 pair[0] = list;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6394 pair[1] = Qnil;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6395 GCPRO2 (directory, list);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6396 pair[1] = w32_find_bdf_fonts_in_dir( XCONS (directory)->car );
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6397 list = Fnconc( 2, pair );
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6398 UNGCPRO;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6399 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6400 return list;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6401 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6402
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6403 /* Find BDF files in a specified directory. (use GCPRO when calling,
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6404 as this calls lisp to get a directory listing). */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6405 Lisp_Object w32_find_bdf_fonts_in_dir( Lisp_Object directory )
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6406 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6407 Lisp_Object filelist, list = Qnil;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6408 char fontname[100];
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6409
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6410 if (!STRINGP(directory))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6411 return Qnil;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6412
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6413 filelist = Fdirectory_files (directory, Qt,
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6414 build_string (".*\\.[bB][dD][fF]"), Qt);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6415
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6416 for ( ; CONSP(filelist); filelist = XCONS (filelist)->cdr)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6417 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6418 Lisp_Object filename = XCONS (filelist)->car;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6419 if (w32_BDF_to_x_font (XSTRING (filename)->data, fontname, 100))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6420 store_in_alist (&list, build_string (fontname), filename);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6421 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6422 return list;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6423 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6424
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6425
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6426 DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6427 "Return non-nil if color COLOR is supported on frame FRAME.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6428 If FRAME is omitted or nil, use the selected frame.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6429 (color, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6430 Lisp_Object color, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6431 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6432 COLORREF foo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6433 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6435 CHECK_STRING (color, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6436
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6437 if (defined_color (f, XSTRING (color)->data, &foo, 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6438 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6439 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6440 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6441 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6442
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6443 DEFUN ("x-color-values", Fx_color_values, Sx_color_values, 1, 2, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6444 "Return a description of the color named COLOR on frame FRAME.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6445 The value is a list of integer RGB values--(RED GREEN BLUE).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6446 These values appear to range from 0 to 65280 or 65535, depending\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6447 on the system; white is (65280 65280 65280) or (65535 65535 65535).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6448 If FRAME is omitted or nil, use the selected frame.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6449 (color, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6450 Lisp_Object color, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6451 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6452 COLORREF foo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6453 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6454
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6455 CHECK_STRING (color, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6456
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6457 if (defined_color (f, XSTRING (color)->data, &foo, 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6458 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6459 Lisp_Object rgb[3];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6460
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6461 rgb[0] = make_number ((GetRValue (foo) << 8) | GetRValue (foo));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6462 rgb[1] = make_number ((GetGValue (foo) << 8) | GetGValue (foo));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6463 rgb[2] = make_number ((GetBValue (foo) << 8) | GetBValue (foo));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6464 return Flist (3, rgb);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6465 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6466 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6467 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6468 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6469
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6470 DEFUN ("x-display-color-p", Fx_display_color_p, Sx_display_color_p, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6471 "Return t if the X display supports color.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6472 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6473 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
6474 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6475 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6476 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6477 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6478 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6479
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6480 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 2)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6481 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6482
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6483 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6484 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6485
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6486 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
6487 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6488 "Return t if the X display supports shades of gray.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6489 Note that color displays do support shades of gray.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6490 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6491 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
6492 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6493 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6494 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6495 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6496 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6497
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6498 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6499 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6500
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6501 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6502 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6503
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6504 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
6505 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6506 "Returns the width in pixels of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6507 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6508 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
6509 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6510 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6511 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6512 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6513 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6514
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6515 return make_number (dpyinfo->width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6516 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6517
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6518 DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6519 Sx_display_pixel_height, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6520 "Returns the height in pixels of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6521 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6522 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
6523 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6524 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6525 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6526 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6527 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6528
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6529 return make_number (dpyinfo->height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6530 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6531
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6532 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6533 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6534 "Returns the number of bitplanes of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6535 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6536 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
6537 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6538 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6539 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6540 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6541 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6542
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6543 return make_number (dpyinfo->n_planes * dpyinfo->n_cbits);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6544 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6545
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6546 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
6547 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6548 "Returns the number of color cells of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6549 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6550 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
6551 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6552 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6553 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6554 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6555 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6556 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6557 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6558
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6559 hdc = GetDC (dpyinfo->root_window);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6560 if (dpyinfo->has_palette)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6561 cap = GetDeviceCaps (hdc,SIZEPALETTE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6562 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6563 cap = GetDeviceCaps (hdc,NUMCOLORS);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6564
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6565 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6566
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6567 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6568 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6569
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6570 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6571 Sx_server_max_request_size,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6572 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6573 "Returns the maximum request size of the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6574 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6575 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
6576 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6577 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6578 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6579 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6580 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6581
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6582 return make_number (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6583 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6584
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6585 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
6586 "Returns the vendor ID string of the W32 system (Microsoft).\n\
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6587 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6588 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
6589 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6590 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6591 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6592 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6593 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6594 char *vendor = "Microsoft Corp.";
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6595
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6596 if (! vendor) vendor = "";
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6597 return build_string (vendor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6598 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6599
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6600 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
6601 "Returns the version numbers of the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6602 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
6603 version numbers, and the vendor-specific release\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6604 number. See also the function `x-server-vendor'.\n\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6605 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6606 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
6607 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6608 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6609 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6610 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6611 struct w32_display_info *dpyinfo = check_x_display_info (display);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6612
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6613 return Fcons (make_number (w32_major_version),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6614 Fcons (make_number (w32_minor_version), Qnil));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6615 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6616
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6617 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
6618 "Returns the number of screens on the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6619 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6620 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
6621 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6622 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6623 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6624 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6625 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6626
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6627 return make_number (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6628 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6629
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6630 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
6631 "Returns the height in millimeters of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6632 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6633 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
6634 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6635 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6636 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6637 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6638 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6639 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6640 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6641
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6642 hdc = GetDC (dpyinfo->root_window);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
6643
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6644 cap = GetDeviceCaps (hdc, VERTSIZE);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
6645
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6646 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6647
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6648 return make_number (cap);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6651 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
6652 "Returns the width in millimeters of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6653 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6654 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
6655 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6656 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6657 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6658 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6659 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6660
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6661 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6662 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6663
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6664 hdc = GetDC (dpyinfo->root_window);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
6665
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6666 cap = GetDeviceCaps (hdc, HORZSIZE);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
6667
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6668 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6669
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6670 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6671 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6672
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6673 DEFUN ("x-display-backing-store", Fx_display_backing_store,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6674 Sx_display_backing_store, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6675 "Returns an indication of whether display DISPLAY does backing store.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6676 The value may be `always', `when-mapped', or `not-useful'.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6677 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6678 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
6679 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6680 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6681 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6682 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6683 return intern ("not-useful");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6684 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6685
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6686 DEFUN ("x-display-visual-class", Fx_display_visual_class,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6687 Sx_display_visual_class, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6688 "Returns the visual class of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6689 The value is one of the symbols `static-gray', `gray-scale',\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6690 `static-color', `pseudo-color', `true-color', or `direct-color'.\n\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6691 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6692 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
6693 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6694 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6695 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6696 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6697 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6698
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6699 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6700 switch (dpyinfo->visual->class)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6701 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6702 case StaticGray: return (intern ("static-gray"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6703 case GrayScale: return (intern ("gray-scale"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6704 case StaticColor: return (intern ("static-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6705 case PseudoColor: return (intern ("pseudo-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6706 case TrueColor: return (intern ("true-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6707 case DirectColor: return (intern ("direct-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6708 default:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6709 error ("Display has an unknown visual class");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6710 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6711 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6712
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6713 error ("Display has an unknown visual class");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6714 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6715
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6716 DEFUN ("x-display-save-under", Fx_display_save_under,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6717 Sx_display_save_under, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6718 "Returns t if the display DISPLAY supports the save-under feature.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6719 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6720 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
6721 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6722 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6723 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6724 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6725 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6726
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6727 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6728 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6729
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6730 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6731 x_pixel_width (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6732 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6733 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6734 return PIXEL_WIDTH (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6735 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6736
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6737 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6738 x_pixel_height (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6739 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6740 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6741 return PIXEL_HEIGHT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6742 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6743
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6744 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6745 x_char_width (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6746 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6747 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6748 return FONT_WIDTH (f->output_data.w32->font);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6749 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6750
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6751 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6752 x_char_height (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6753 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6754 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6755 return f->output_data.w32->line_height;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6756 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6757
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6758 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6759 x_screen_planes (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6760 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6761 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6762 return (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
6763 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_cbits);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6764 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6765
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6766 /* Return the display structure for the display named NAME.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6767 Open a new connection if necessary. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6768
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6769 struct w32_display_info *
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6770 x_display_info_for_name (name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6771 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6772 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6773 Lisp_Object names;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6774 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6775
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6776 CHECK_STRING (name, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6777
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6778 for (dpyinfo = &one_w32_display_info, names = w32_display_name_list;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6779 dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6780 dpyinfo = dpyinfo->next, names = XCONS (names)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6781 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6782 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6783 tem = Fstring_equal (XCONS (XCONS (names)->car)->car, name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6784 if (!NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6785 return dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6786 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6787
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6788 /* Use this general default value to start with. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6789 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6790
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6791 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6792
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6793 dpyinfo = w32_term_init (name, (unsigned char *)0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6794 (char *) XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6795
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6796 if (dpyinfo == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6797 error ("Cannot connect to server %s", XSTRING (name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6798
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6799 w32_in_use = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6800 XSETFASTINT (Vwindow_system_version, 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6801
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6802 return dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6803 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6804
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6805 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6806 1, 3, 0, "Open a connection to a server.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6807 DISPLAY is the name of the display to connect to.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6808 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
6809 If the optional third arg MUST-SUCCEED is non-nil,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6810 terminate Emacs if we can't open the connection.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6811 (display, xrm_string, must_succeed)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6812 Lisp_Object display, xrm_string, must_succeed;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6813 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6814 unsigned int n_planes;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6815 unsigned char *xrm_option;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6816 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6817
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6818 CHECK_STRING (display, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6819 if (! NILP (xrm_string))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6820 CHECK_STRING (xrm_string, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6821
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6822 if (! EQ (Vwindow_system, intern ("w32")))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6823 error ("Not using Microsoft Windows");
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6824
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6825 /* 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
6826 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
6827 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6828 Lisp_Object color_file;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6829 struct gcpro gcpro1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6830
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6831 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
6832
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6833 GCPRO1 (color_file);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6834
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6835 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
6836 color_file =
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6837 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
6838 Fsymbol_value (intern ("data-directory")));
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6839
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6840 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
6841
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6842 UNGCPRO;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6843 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6844 if (NILP (Vw32_color_map))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6845 Vw32_color_map = Fw32_default_color_map ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6846
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6847 if (! NILP (xrm_string))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6848 xrm_option = (unsigned char *) XSTRING (xrm_string)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6849 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6850 xrm_option = (unsigned char *) 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6851
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6852 /* 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
6853 /* 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
6854 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6855 char basename[ MAX_PATH ], *str;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6856
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6857 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
6858 str = strrchr (basename, '.');
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6859 if (str) *str = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6860 Vinvocation_name = build_string (basename);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6861 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6862 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6863
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6864 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6865
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6866 /* This is what opens the connection and sets x_current_display.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6867 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
6868 dpyinfo = w32_term_init (display, xrm_option,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6869 (char *) XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6870
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6871 if (dpyinfo == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6872 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6873 if (!NILP (must_succeed))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
6874 fatal ("Cannot connect to server %s.\n",
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
6875 XSTRING (display)->data);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6876 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6877 error ("Cannot connect to server %s", XSTRING (display)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6878 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6879
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6880 w32_in_use = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6881
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6882 XSETFASTINT (Vwindow_system_version, 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6883 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6884 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6885
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6886 DEFUN ("x-close-connection", Fx_close_connection,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6887 Sx_close_connection, 1, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6888 "Close the connection to DISPLAY's server.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6889 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
6890 If DISPLAY is nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6891 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6892 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6893 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6894 struct w32_display_info *dpyinfo = check_x_display_info (display);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6895 struct w32_display_info *tail;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6896 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6897
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6898 if (dpyinfo->reference_count > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6899 error ("Display still has frames on it");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6900
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6901 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6902 /* Free the fonts in the font table. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6903 for (i = 0; i < dpyinfo->n_fonts; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6904 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6905 if (dpyinfo->font_table[i].name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6906 free (dpyinfo->font_table[i].name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6907 /* Don't free the full_name string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6908 it is always shared with something else. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6909 w32_unload_font (dpyinfo, dpyinfo->font_table[i].font);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6910 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6911 x_destroy_all_bitmaps (dpyinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6912
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6913 x_delete_display (dpyinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6914 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6915
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6916 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6917 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6918
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6919 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
6920 "Return the list of display names that Emacs has connections to.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6921 ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6922 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6923 Lisp_Object tail, result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6924
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6925 result = Qnil;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6926 for (tail = w32_display_name_list; ! NILP (tail); tail = XCONS (tail)->cdr)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6927 result = Fcons (XCONS (XCONS (tail)->car)->car, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6928
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6929 return result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6930 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6931
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6932 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6933 "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
6934 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
6935 This is a noop on W32 systems.\n\
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6936 The optional second argument DISPLAY specifies which display to act on.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6937 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
6938 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
6939 (on, display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6940 Lisp_Object display, on;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6941 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6942 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6943
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6944 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6945 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6946
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6947
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6948 /* These are the w32 specialized functions */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6949
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6950 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
6951 "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
6952 (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6953 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6954 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6955 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6956 CHOOSEFONT cf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6957 LOGFONT lf;
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6958 TEXTMETRIC tm;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6959 HDC hdc;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6960 HANDLE oldobj;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6961 char buf[100];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6962
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6963 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
6964 bzero (&lf, sizeof (lf));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6965
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6966 cf.lStructSize = sizeof (cf);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6967 cf.hwndOwner = FRAME_W32_WINDOW (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6968 cf.Flags = CF_FIXEDPITCHONLY | CF_FORCEFONTEXIST | CF_SCREENFONTS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6969 cf.lpLogFont = &lf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6970
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6971 /* 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
6972 default font. */
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6973 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
6974 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
6975 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
6976 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
6977 {
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6978 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
6979 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
6980 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
6981 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
6982 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
6983 lf.lfPitchAndFamily = tm.tmPitchAndFamily;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6984 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
6985 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
6986 }
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6987 SelectObject (hdc, oldobj);
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6988 ReleaseDC (FRAME_W32_WINDOW(f), hdc);
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
6989
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6990 if (!ChooseFont (&cf) || !w32_to_x_font (&lf, buf, 100))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
6991 return Qnil;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6992
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6993 return build_string (buf);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6994 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6995
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6996 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
6997 "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
6998 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
6999 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
7000 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
7001 screen saver if defined.\n\
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7002 \n\
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7003 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
7004 (command, frame)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7005 Lisp_Object command, frame;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7006 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7007 WPARAM code;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7008 FRAME_PTR f = check_x_frame (frame);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7009
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7010 CHECK_NUMBER (command, 0);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7011
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
7012 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
7013
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7014 return Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7015 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7016
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7017 DEFUN ("w32-shell-execute", Fw32_shell_execute, Sw32_shell_execute, 2, 4, 0,
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7018 "Get Windows to perform OPERATION on DOCUMENT.\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7019 This is a wrapper around the ShellExecute system function, which\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7020 invokes the application registered to handle OPERATION for DOCUMENT.\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7021 OPERATION is typically \"open\", \"print\" or \"explore\", and DOCUMENT\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7022 is typically the name of a document file or URL, but can also be a\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7023 program executable to run or a directory to open in the Windows Explorer.\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7024 \n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7025 If DOCUMENT is a program executable, PARAMETERS can be a list of command\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7026 line parameters, but otherwise should be nil.\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7027 \n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7028 SHOW-FLAG can be used to control whether the invoked application is hidden\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7029 or minimized. If SHOw-FLAG is nil, the application is displayed normally,\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7030 otherwise it is an integer representing a ShowWindow flag:\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7031 \n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7032 0 - start hidden\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7033 1 - start normally\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7034 3 - start maximized\n\
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7035 6 - start minimized")
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7036 (operation, document, parameters, show_flag)
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7037 Lisp_Object operation, document, parameters, show_flag;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7038 {
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7039 Lisp_Object current_dir;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7040
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7041 CHECK_STRING (operation, 0);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7042 CHECK_STRING (document, 0);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7043
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7044 /* Encode filename and current directory. */
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7045 current_dir = ENCODE_FILE (current_buffer->directory);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7046 document = ENCODE_FILE (document);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7047 if ((int) ShellExecute (NULL,
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7048 XSTRING (operation)->data,
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7049 XSTRING (document)->data,
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7050 (STRINGP (parameters) ?
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7051 XSTRING (parameters)->data : NULL),
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7052 XSTRING (current_dir)->data,
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7053 (INTEGERP (show_flag) ?
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7054 XINT (show_flag) : SW_SHOWDEFAULT))
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7055 > 32)
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7056 return Qt;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7057 error ("ShellExecute failed");
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7058 }
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7059
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7060 /* 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
7061 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
7062 lispy_function_keys. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7063 static int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7064 lookup_vk_code (char *key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7065 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7066 int i;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7067
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7068 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
7069 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
7070 && 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
7071 return i;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7072
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7073 return -1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7074 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7075
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7076 /* 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
7077 definition. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7078 static int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7079 w32_parse_hot_key (key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7080 Lisp_Object key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7081 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7082 /* 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
7083 register Lisp_Object c;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7084 int vk_code;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7085 int lisp_modifiers;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7086 int w32_modifiers;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7087 struct gcpro gcpro1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7088
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7089 CHECK_VECTOR (key, 0);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7090
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7091 if (XFASTINT (Flength (key)) != 1)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7092 return Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7093
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7094 GCPRO1 (key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7095
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7096 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
7097
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7098 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
7099 c = Fevent_convert_list (c);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7100
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7101 UNGCPRO;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7102
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7103 if (! INTEGERP (c) && ! SYMBOLP (c))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7104 error ("Key definition is invalid");
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7105
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7106 /* 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
7107 if (SYMBOLP (c))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7108 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7109 c = parse_modifiers (c);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7110 lisp_modifiers = Fcar (Fcdr (c));
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7111 c = Fcar (c);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7112 if (!SYMBOLP (c))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7113 abort ();
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7114 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
7115 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7116 else if (INTEGERP (c))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7117 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7118 lisp_modifiers = XINT (c) & ~CHARACTERBITS;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7119 /* 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
7120 vk_code = XINT (c) & CHARACTERBITS;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7121 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7122
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7123 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
7124 return Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7125
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7126 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
7127 && !NILP (Vw32_alt_is_meta))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7128 lisp_modifiers |= alt_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7129
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7130 /* 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
7131 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
7132 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
7133 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
7134 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
7135
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7136 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
7137 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7138
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7139 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
7140 "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
7141 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
7142 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
7143 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
7144 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
7145 \n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7146 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
7147 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
7148 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
7149 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
7150 \n\
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7151 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
7152 (key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7153 Lisp_Object key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7154 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7155 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
7156
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7157 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
7158 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7159 /* 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
7160 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
7161
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7162 /* 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
7163 if (NILP (item))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7164 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
7165 else
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7166 XCAR (item) = key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7167
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7168 /* 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
7169 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
7170 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
7171 (WPARAM) key, 0);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7172 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7173
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7174 return key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7175 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7176
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7177 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
7178 "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
7179 (key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7180 Lisp_Object key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7181 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7182 Lisp_Object item;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7183
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7184 if (!INTEGERP (key))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7185 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
7186
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7187 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
7188
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7189 if (!NILP (item))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7190 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7191 /* 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
7192 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
7193 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
7194 (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
7195 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7196 MSG msg;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7197 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
7198 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7199 return Qt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7200 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7201 return Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7202 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7203
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7204 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
7205 "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
7206 ()
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7207 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7208 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
7209 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7210
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7211 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
7212 "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
7213 (hotkeyid)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7214 Lisp_Object hotkeyid;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7215 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7216 int vk_code, w32_modifiers;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7217 Lisp_Object key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7218
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7219 CHECK_NUMBER (hotkeyid, 0);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7220
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7221 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
7222 w32_modifiers = HOTKEY_MODIFIERS (hotkeyid);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7223
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7224 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
7225 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
7226 else
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7227 key = make_number (vk_code);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7228
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7229 key = Fcons (key, Qnil);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7230 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
7231 key = Fcons (Qshift, key);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7232 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
7233 key = Fcons (Qctrl, key);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7234 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
7235 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
7236 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
7237 key = Fcons (Qhyper, key);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7238
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7239 return key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7240 }
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7241
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7242 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
7243 "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
7244 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
7245 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
7246 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
7247 (key, new_state)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7248 Lisp_Object key, new_state;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7249 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7250 int vk_code;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7251 int cur_state;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7252
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7253 if (EQ (key, intern ("capslock")))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7254 vk_code = VK_CAPITAL;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7255 else if (EQ (key, intern ("kp-numlock")))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7256 vk_code = VK_NUMLOCK;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7257 else if (EQ (key, intern ("scroll")))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7258 vk_code = VK_SCROLL;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7259 else
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7260 return Qnil;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7261
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7262 if (!dwWindowsThreadId)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7263 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
7264
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7265 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
7266 (WPARAM) vk_code, (LPARAM) new_state))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7267 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7268 MSG msg;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7269 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
7270 return make_number (msg.wParam);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7271 }
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7272 return Qnil;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7273 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7274
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7275 syms_of_w32fns ()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7276 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7277 /* 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
7278 w32_in_use = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7279
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7280 /* 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
7281 just above where these variables are declared. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7282 /*&&& init symbols here &&&*/
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7283 Qauto_raise = intern ("auto-raise");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7284 staticpro (&Qauto_raise);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7285 Qauto_lower = intern ("auto-lower");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7286 staticpro (&Qauto_lower);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7287 Qbackground_color = intern ("background-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7288 staticpro (&Qbackground_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7289 Qbar = intern ("bar");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7290 staticpro (&Qbar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7291 Qborder_color = intern ("border-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7292 staticpro (&Qborder_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7293 Qborder_width = intern ("border-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7294 staticpro (&Qborder_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7295 Qbox = intern ("box");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7296 staticpro (&Qbox);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7297 Qcursor_color = intern ("cursor-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7298 staticpro (&Qcursor_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7299 Qcursor_type = intern ("cursor-type");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7300 staticpro (&Qcursor_type);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7301 Qforeground_color = intern ("foreground-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7302 staticpro (&Qforeground_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7303 Qgeometry = intern ("geometry");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7304 staticpro (&Qgeometry);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7305 Qicon_left = intern ("icon-left");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7306 staticpro (&Qicon_left);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7307 Qicon_top = intern ("icon-top");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7308 staticpro (&Qicon_top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7309 Qicon_type = intern ("icon-type");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7310 staticpro (&Qicon_type);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7311 Qicon_name = intern ("icon-name");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7312 staticpro (&Qicon_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7313 Qinternal_border_width = intern ("internal-border-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7314 staticpro (&Qinternal_border_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7315 Qleft = intern ("left");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7316 staticpro (&Qleft);
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
7317 Qright = intern ("right");
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
7318 staticpro (&Qright);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7319 Qmouse_color = intern ("mouse-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7320 staticpro (&Qmouse_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7321 Qnone = intern ("none");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7322 staticpro (&Qnone);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7323 Qparent_id = intern ("parent-id");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7324 staticpro (&Qparent_id);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7325 Qscroll_bar_width = intern ("scroll-bar-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7326 staticpro (&Qscroll_bar_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7327 Qsuppress_icon = intern ("suppress-icon");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7328 staticpro (&Qsuppress_icon);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7329 Qtop = intern ("top");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7330 staticpro (&Qtop);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7331 Qundefined_color = intern ("undefined-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7332 staticpro (&Qundefined_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7333 Qvertical_scroll_bars = intern ("vertical-scroll-bars");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7334 staticpro (&Qvertical_scroll_bars);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7335 Qvisibility = intern ("visibility");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7336 staticpro (&Qvisibility);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7337 Qwindow_id = intern ("window-id");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7338 staticpro (&Qwindow_id);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7339 Qx_frame_parameter = intern ("x-frame-parameter");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7340 staticpro (&Qx_frame_parameter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7341 Qx_resource_name = intern ("x-resource-name");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7342 staticpro (&Qx_resource_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7343 Quser_position = intern ("user-position");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7344 staticpro (&Quser_position);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7345 Quser_size = intern ("user-size");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7346 staticpro (&Quser_size);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7347 Qdisplay = intern ("display");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7348 staticpro (&Qdisplay);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7349 /* This is the end of symbol initialization. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7350
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7351 Qhyper = intern ("hyper");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7352 staticpro (&Qhyper);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7353 Qsuper = intern ("super");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7354 staticpro (&Qsuper);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7355 Qmeta = intern ("meta");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7356 staticpro (&Qmeta);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7357 Qalt = intern ("alt");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7358 staticpro (&Qalt);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7359 Qctrl = intern ("ctrl");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7360 staticpro (&Qctrl);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7361 Qcontrol = intern ("control");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7362 staticpro (&Qcontrol);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7363 Qshift = intern ("shift");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7364 staticpro (&Qshift);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7365
22625
e7bd87148368 (Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents: 22078
diff changeset
7366 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
7367 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
7368
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7369 Fput (Qundefined_color, Qerror_conditions,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7370 Fcons (Qundefined_color, Fcons (Qerror, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7371 Fput (Qundefined_color, Qerror_message,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7372 build_string ("Undefined color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7373
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7374 staticpro (&w32_grabbed_keys);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7375 w32_grabbed_keys = Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7376
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7377 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
7378 "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
7379 Vw32_color_map = Qnil;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7380
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7381 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
7382 "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
7383 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
7384 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
7385 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
7386
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7387 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
7388 "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
7389 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
7390 Vw32_alt_is_meta = Qt;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7391
24339
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
7392 DEFVAR_INT ("w32-quit-key", &Vw32_quit_key,
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
7393 "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
7394 XSETINT (Vw32_quit_key, 0);
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
7395
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7396 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
7397 &Vw32_pass_lwindow_to_system,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7398 "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
7399 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
7400 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
7401
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7402 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
7403 &Vw32_pass_rwindow_to_system,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7404 "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
7405 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
7406 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
7407
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7408 DEFVAR_INT ("w32-phantom-key-code",
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7409 &Vw32_phantom_key_code,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7410 "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
7411 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
7412 \n\
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7413 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
7414 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
7415 `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
7416 /* 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
7417 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
7418 Vw32_phantom_key_code = 255;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7419
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7420 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
7421 &Vw32_enable_num_lock,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7422 "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
7423 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
7424 Vw32_enable_num_lock = Qt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7425
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7426 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
7427 &Vw32_enable_caps_lock,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7428 "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
7429 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
7430 Vw32_enable_caps_lock = Qt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7431
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7432 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
7433 &Vw32_scroll_lock_modifier,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7434 "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
7435 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
7436 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
7437 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
7438 Vw32_scroll_lock_modifier = Qt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7439
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7440 DEFVAR_LISP ("w32-lwindow-modifier",
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7441 &Vw32_lwindow_modifier,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7442 "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
7443 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
7444 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
7445 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
7446 Vw32_lwindow_modifier = Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7447
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7448 DEFVAR_LISP ("w32-rwindow-modifier",
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7449 &Vw32_rwindow_modifier,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7450 "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
7451 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
7452 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
7453 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
7454 Vw32_rwindow_modifier = Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7455
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7456 DEFVAR_LISP ("w32-apps-modifier",
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7457 &Vw32_apps_modifier,
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7458 "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
7459 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
7460 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
7461 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
7462 Vw32_apps_modifier = Qnil;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7463
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7464 DEFVAR_LISP ("w32-enable-italics", &Vw32_enable_italics,
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7465 "Non-nil enables selection of artificially italicized fonts.");
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7466 Vw32_enable_italics = Qnil;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7467
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7468 DEFVAR_LISP ("w32-enable-palette", &Vw32_enable_palette,
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7469 "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
7470 Vw32_enable_palette = Qt;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7471
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7472 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
7473 &Vw32_mouse_button_tolerance,
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7474 "Analogue of double click interval for faking middle mouse events.\n\
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7475 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
7476 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
7477 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
7478 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
7479 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
7480
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7481 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
7482 &Vw32_mouse_move_interval,
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
7483 "Minimum interval between mouse move events.\n\
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
7484 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
7485 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
7486 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
7487 XSETINT (Vw32_mouse_move_interval, 0);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
7488
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7489 init_x_parm_symbols ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7490
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7491 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
7492 "List of directories to search for bitmap files for w32.");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7493 Vx_bitmap_file_path = decode_env_path ((char *) 0, "PATH");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7494
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7495 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7496 "The shape of the pointer when over text.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7497 Changing the value does not affect existing frames\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7498 unless you set the mouse color.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7499 Vx_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7500
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7501 DEFVAR_LISP ("x-resource-name", &Vx_resource_name,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7502 "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
7503 `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
7504 when requesting resource values.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7505 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
7506 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
7507 switches, if present.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7508 Vx_resource_name = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7509
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7510 Vx_nontext_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7511
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7512 Vx_mode_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7513
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7514 DEFVAR_INT ("x-sensitive-text-pointer-shape",
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7515 &Vx_sensitive_text_pointer_shape,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7516 "The shape of the pointer when over mouse-sensitive text.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7517 This variable takes effect when you create a new frame\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7518 or when you set the mouse color.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7519 Vx_sensitive_text_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7520
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7521 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7522 "A string indicating the foreground color of the cursor box.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7523 Vx_cursor_fore_pixel = Qnil;
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 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7526 "Non-nil if no window manager is in use.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7527 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
7528 unless you set it to something else.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7529 /* 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
7530 and maybe the user would like to set it to t. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7531 Vx_no_window_manager = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7532
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7533 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
7534 &Vx_pixel_size_width_font_regexp,
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7535 "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
7536 \n\
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7537 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
7538 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
7539 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
7540 Chinese, Japanese, and Korean.");
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7541 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
7542
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7543 DEFVAR_LISP ("w32-bdf-filename-alist",
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7544 &Vw32_bdf_filename_alist,
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7545 "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
7546 Vw32_bdf_filename_alist = Qnil;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7547
24481
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
7548 DEFVAR_BOOL ("w32-strict-fontnames",
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
7549 &w32_strict_fontnames,
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
7550 "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
7551 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
7552 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
7553 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
7554 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
7555 fontsets are automatically created.");
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
7556 w32_strict_fontnames = 0;
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
7557
24695
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
7558 DEFVAR_BOOL ("w32-strict-painting",
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
7559 &w32_strict_painting,
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
7560 "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
7561 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
7562 only be necessary if the default setting causes problems.");
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
7563 w32_strict_painting = 1;
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
7564
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
7565 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
7566 &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
7567 "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
7568 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
7569
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7570 defsubr (&Sx_get_resource);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7571 defsubr (&Sx_list_fonts);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7572 defsubr (&Sx_display_color_p);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7573 defsubr (&Sx_display_grayscale_p);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7574 defsubr (&Sx_color_defined_p);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7575 defsubr (&Sx_color_values);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7576 defsubr (&Sx_server_max_request_size);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7577 defsubr (&Sx_server_vendor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7578 defsubr (&Sx_server_version);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7579 defsubr (&Sx_display_pixel_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7580 defsubr (&Sx_display_pixel_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7581 defsubr (&Sx_display_mm_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7582 defsubr (&Sx_display_mm_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7583 defsubr (&Sx_display_screens);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7584 defsubr (&Sx_display_planes);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7585 defsubr (&Sx_display_color_cells);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7586 defsubr (&Sx_display_visual_class);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7587 defsubr (&Sx_display_backing_store);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7588 defsubr (&Sx_display_save_under);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7589 defsubr (&Sx_parse_geometry);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7590 defsubr (&Sx_create_frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7591 defsubr (&Sx_open_connection);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7592 defsubr (&Sx_close_connection);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7593 defsubr (&Sx_display_list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7594 defsubr (&Sx_synchronize);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7595
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7596 /* W32 specific functions */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7597
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7598 defsubr (&Sw32_focus_frame);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7599 defsubr (&Sw32_select_font);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7600 defsubr (&Sw32_define_rgb_color);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7601 defsubr (&Sw32_default_color_map);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7602 defsubr (&Sw32_load_color_file);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
7603 defsubr (&Sw32_send_sys_command);
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
7604 defsubr (&Sw32_shell_execute);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7605 defsubr (&Sw32_register_hot_key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7606 defsubr (&Sw32_unregister_hot_key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7607 defsubr (&Sw32_registered_hot_keys);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
7608 defsubr (&Sw32_reconstruct_hot_key);
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
7609 defsubr (&Sw32_toggle_lock_key);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
7610 defsubr (&Sw32_find_bdf_fonts);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7611
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7612 /* Setting callback functions for fontset handler. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7613 get_font_info_func = w32_get_font_info;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7614 list_fonts_func = w32_list_fonts;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7615 load_font_func = w32_load_font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7616 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
7617 query_font_func = w32_query_font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
7618 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
7619 check_window_system_func = check_w32;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7620 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7621
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7622 #undef abort
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7623
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7624 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
7625 w32_abort()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7626 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7627 int button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7628 button = MessageBox (NULL,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7629 "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
7630 "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
7631 "Emacs Abort Dialog",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7632 MB_ICONEXCLAMATION | MB_TASKMODAL
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7633 | MB_SETFOREGROUND | MB_ABORTRETRYIGNORE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7634 switch (button)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7635 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7636 case IDRETRY:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7637 DebugBreak ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7638 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7639 case IDIGNORE:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7640 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7641 case IDABORT:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7642 default:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7643 abort ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7644 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
7645 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7646 }
15148
220145cf7546 (continuation of previous checkin)
Geoff Voelker <voelker@cs.washington.edu>
parents: 15147
diff changeset
7647
23801
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
7648 /* For convenience when debugging. */
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
7649 int
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
7650 w32_last_error()
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
7651 {
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
7652 return GetLastError ();
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
7653 }