annotate src/w32fns.c @ 16259:f54af1701a5f

(Qright): New variable. (syms_of_win32fns): Initialize and staticpro Qright. (x_set_vertical_scroll_bars): Check for left<->right<->none scroll bar changes, and modify the vertical scroll bar type as appropriate. (x_figure_window_size): Use new SET_FRAME_WIDTH macro. (Fx_create_frame): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Sat, 21 Sep 1996 02:25:11 +0000
parents fdd1b2ade15d
children 481b7874a1e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1 /* Functions for the Win32 window system.
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23 #include <signal.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
24 #include <config.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
25 #include <stdio.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
26
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
27 #include "lisp.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
28 #include "w32term.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
29 #include "frame.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
30 #include "window.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
31 #include "buffer.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
32 #include "dispextern.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
33 #include "keyboard.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34 #include "blockinput.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
35 #include "paths.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
36 #include "ntheap.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
37 #include "termhooks.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
38
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
39 #include <commdlg.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
40
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
41 extern void abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
42 extern void free_frame_menubar ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
43 extern struct scroll_bar *x_window_to_scroll_bar ();
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
44 extern int quit_char;
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 /* The colormap for converting color names to RGB values */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
47 Lisp_Object Vwin32_color_map;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
48
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
49 /* Non nil if alt key presses are passed on to Windows. */
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
50 Lisp_Object Vwin32_pass_alt_to_system;
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
51
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
52 /* 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
53 to alt_modifier. */
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
54 Lisp_Object Vwin32_alt_is_meta;
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
55
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
56 /* Non nil if left window, right window, and application key events
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
57 are passed on to Windows. */
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
58 Lisp_Object Vwin32_pass_optional_keys_to_system;
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
59
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
60 /* 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
61 are synthesized, look ugly, and are trashed by cursor movement under NT). */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
62 Lisp_Object Vwin32_enable_italics;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
63
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
64 /* Enable palette management. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
65 Lisp_Object Vwin32_enable_palette;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
66
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
67 /* 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
68 be converted to a middle button down event. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
69 Lisp_Object Vwin32_mouse_button_tolerance;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
70
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
71 /* 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
72 events that are passed on to the event loop. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
73 Lisp_Object Vwin32_mouse_move_interval;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
74
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
75 /* The name we're using in resource queries. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
76 Lisp_Object Vx_resource_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
77
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
78 /* Non nil if no window manager is in use. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
79 Lisp_Object Vx_no_window_manager;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
80
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
81 /* The background and shape of the mouse pointer, and shape when not
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
82 over text or in the modeline. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
83 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
84 /* The shape when over mouse-sensitive text. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
85 Lisp_Object Vx_sensitive_text_pointer_shape;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
86
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
87 /* Color of chars displayed in cursor box. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
88 Lisp_Object Vx_cursor_fore_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
89
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
90 /* Search path for bitmap files. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
91 Lisp_Object Vx_bitmap_file_path;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
92
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
93 /* Evaluate this expression to rebuild the section of syms_of_w32fns
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
94 that initializes and staticpros the symbols declared below. Note
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
95 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
96 evaluate this expression.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
97
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
98 (progn
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
99 ;; Accumulate a list of the symbols we want to initialize from the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
100 ;; declarations at the top of the file.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
101 (goto-char (point-min))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
102 (search-forward "/\*&&& symbols declared here &&&*\/\n")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
103 (let (symbol-list)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
104 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
105 (setq symbol-list
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
106 (cons (buffer-substring (match-beginning 1) (match-end 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
107 symbol-list))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
108 (forward-line 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
109 (setq symbol-list (nreverse symbol-list))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
110 ;; Delete the section of syms_of_... where we initialize the symbols.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
111 (search-forward "\n /\*&&& init symbols here &&&*\/\n")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
112 (let ((start (point)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
113 (while (looking-at "^ Q")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
114 (forward-line 2))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
115 (kill-region start (point)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
116 ;; Write a new symbol initialization section.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
117 (while symbol-list
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
118 (insert (format " %s = intern (\"" (car symbol-list)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
119 (let ((start (point)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
120 (insert (substring (car symbol-list) 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
121 (subst-char-in-region start (point) ?_ ?-))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
122 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
123 (setq symbol-list (cdr symbol-list)))))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
124
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
125 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
126
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
127 /*&&& symbols declared here &&&*/
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
128 Lisp_Object Qauto_raise;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
129 Lisp_Object Qauto_lower;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
130 Lisp_Object Qbackground_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
131 Lisp_Object Qbar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
132 Lisp_Object Qborder_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
133 Lisp_Object Qborder_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
134 Lisp_Object Qbox;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
135 Lisp_Object Qcursor_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
136 Lisp_Object Qcursor_type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
137 Lisp_Object Qforeground_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
138 Lisp_Object Qgeometry;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
139 Lisp_Object Qicon_left;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
140 Lisp_Object Qicon_top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
141 Lisp_Object Qicon_type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
142 Lisp_Object Qicon_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
143 Lisp_Object Qinternal_border_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
144 Lisp_Object Qleft;
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
145 Lisp_Object Qright;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
146 Lisp_Object Qmouse_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
147 Lisp_Object Qnone;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
148 Lisp_Object Qparent_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
149 Lisp_Object Qscroll_bar_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
150 Lisp_Object Qsuppress_icon;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
151 Lisp_Object Qtop;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
152 Lisp_Object Qundefined_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
153 Lisp_Object Qvertical_scroll_bars;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
154 Lisp_Object Qvisibility;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
155 Lisp_Object Qwindow_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
156 Lisp_Object Qx_frame_parameter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
157 Lisp_Object Qx_resource_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
158 Lisp_Object Quser_position;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
159 Lisp_Object Quser_size;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
160 Lisp_Object Qdisplay;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
161
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
162 /* 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
163 #define LMOUSE 1
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
164 #define MMOUSE 2
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
165 #define RMOUSE 4
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
166
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
167 static int button_state = 0;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
168 static Win32Msg saved_mouse_button_msg;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
169 static unsigned mouse_button_timer; /* non-zero when timer is active */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
170 static Win32Msg saved_mouse_move_msg;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
171 static unsigned mouse_move_timer;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
172
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
173 #define MOUSE_BUTTON_ID 1
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
174 #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
175
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
176 /* The below are defined in frame.c. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
177 extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
178 extern Lisp_Object Qunsplittable, Qmenu_bar_lines;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
179
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
180 extern Lisp_Object Vwindow_system_version;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
181
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
182 extern Lisp_Object last_mouse_scroll_bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
183 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
184
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
185 /* From win32term.c. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
186 extern Lisp_Object Vwin32_num_mouse_buttons;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
187
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
188 Time last_mouse_movement_time;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
189
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
190
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
191 /* Extract a frame as a FRAME_PTR, defaulting to the selected frame
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
192 and checking validity for Win32. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
193
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
194 FRAME_PTR
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
195 check_x_frame (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
196 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
197 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
198 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
199
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
200 if (NILP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
201 f = selected_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
202 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
203 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
204 CHECK_LIVE_FRAME (frame, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
205 f = XFRAME (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
206 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
207 if (! FRAME_WIN32_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
208 error ("non-win32 frame used");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
209 return f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
210 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
211
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
212 /* Let the user specify an display with a frame.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
213 nil stands for the selected frame--or, if that is not a win32 frame,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
214 the first display on the list. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
215
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
216 static struct win32_display_info *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
217 check_x_display_info (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
218 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
219 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
220 if (NILP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
221 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
222 if (FRAME_WIN32_P (selected_frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
223 return FRAME_WIN32_DISPLAY_INFO (selected_frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
224 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
225 return &one_win32_display_info;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
226 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
227 else if (STRINGP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
228 return x_display_info_for_name (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
229 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
230 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
231 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
232
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
233 CHECK_LIVE_FRAME (frame, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
234 f = XFRAME (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
235 if (! FRAME_WIN32_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
236 error ("non-win32 frame used");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
237 return FRAME_WIN32_DISPLAY_INFO (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
238 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
239 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
240
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
241 /* Return the Emacs frame-object corresponding to an win32 window.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
242 It could be the frame's main window or an icon window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
243
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
244 /* 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
245
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
246 struct frame *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
247 x_window_to_frame (dpyinfo, wdesc)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
248 struct win32_display_info *dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
249 HWND wdesc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
250 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
251 Lisp_Object tail, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
252 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
253
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
254 for (tail = Vframe_list; GC_CONSP (tail); tail = XCONS (tail)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
255 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
256 frame = XCONS (tail)->car;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
257 if (!GC_FRAMEP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
258 continue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
259 f = XFRAME (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
260 if (f->output_data.nothing == 1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
261 || FRAME_WIN32_DISPLAY_INFO (f) != dpyinfo)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
262 continue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
263 if (FRAME_WIN32_WINDOW (f) == wdesc)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
264 return f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
265 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
266 return 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
267 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
268
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
269
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
270
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
271 /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
272 id, which is just an int that this section returns. Bitmaps are
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
273 reference counted so they can be shared among frames.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
274
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
275 Bitmap indices are guaranteed to be > 0, so a negative number can
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
276 be used to indicate no bitmap.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
277
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
278 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
279 the bitmaps yourself. That is, creating a bitmap from the same
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
280 data more than once will not be caught. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
281
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
282
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
283 /* Functions to access the contents of a bitmap, given an id. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
284
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
285 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
286 x_bitmap_height (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
287 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
288 int id;
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 return FRAME_WIN32_DISPLAY_INFO (f)->bitmaps[id - 1].height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
291 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
292
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
293 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
294 x_bitmap_width (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
295 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
296 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
297 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
298 return FRAME_WIN32_DISPLAY_INFO (f)->bitmaps[id - 1].width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
299 }
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 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
302 x_bitmap_pixmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
303 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
304 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
305 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
306 return (int) FRAME_WIN32_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
307 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
308
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 /* Allocate a new bitmap record. Returns index of new record. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
311
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
312 static int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
313 x_allocate_bitmap_record (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
314 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
315 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
316 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
317 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
318
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
319 if (dpyinfo->bitmaps == NULL)
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 dpyinfo->bitmaps_size = 10;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
322 dpyinfo->bitmaps
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
323 = (struct win32_bitmap_record *) xmalloc (dpyinfo->bitmaps_size * sizeof (struct win32_bitmap_record));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
324 dpyinfo->bitmaps_last = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
325 return 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
326 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
327
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
328 if (dpyinfo->bitmaps_last < dpyinfo->bitmaps_size)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
329 return ++dpyinfo->bitmaps_last;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
330
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
331 for (i = 0; i < dpyinfo->bitmaps_size; ++i)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
332 if (dpyinfo->bitmaps[i].refcount == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
333 return i + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
334
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
335 dpyinfo->bitmaps_size *= 2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
336 dpyinfo->bitmaps
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
337 = (struct win32_bitmap_record *) xrealloc (dpyinfo->bitmaps,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
338 dpyinfo->bitmaps_size * sizeof (struct win32_bitmap_record));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
339 return ++dpyinfo->bitmaps_last;
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
342 /* 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
343
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
344 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
345 x_reference_bitmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
346 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
347 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
348 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
349 ++FRAME_WIN32_DISPLAY_INFO (f)->bitmaps[id - 1].refcount;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
350 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
351
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
352 /* 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
353
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
354 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
355 x_create_bitmap_from_data (f, bits, width, height)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
356 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
357 char *bits;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
358 unsigned int width, height;
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 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
361 Pixmap bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
362 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
363
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
364 bitmap = CreateBitmap (width, height,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
365 FRAME_WIN32_DISPLAY_INFO (XFRAME (frame))->n_planes,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
366 FRAME_WIN32_DISPLAY_INFO (XFRAME (frame))->n_cbits,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
367 bits);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
368
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
369 if (! bitmap)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
370 return -1;
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 id = x_allocate_bitmap_record (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
373 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
374 dpyinfo->bitmaps[id - 1].file = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
375 dpyinfo->bitmaps[id - 1].hinst = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
376 dpyinfo->bitmaps[id - 1].refcount = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
377 dpyinfo->bitmaps[id - 1].depth = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
378 dpyinfo->bitmaps[id - 1].height = height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
379 dpyinfo->bitmaps[id - 1].width = width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
380
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
381 return id;
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
384 /* Create bitmap from file FILE for frame F. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
385
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
386 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
387 x_create_bitmap_from_file (f, file)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
388 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
389 Lisp_Object file;
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 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
392 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
393 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
394 unsigned int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
395 Pixmap bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
396 int xhot, yhot, result, id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
397 Lisp_Object found;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
398 int fd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
399 char *filename;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
400 HINSTANCE hinst;
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 /* Look for an existing bitmap with the same name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
403 for (id = 0; id < dpyinfo->bitmaps_last; ++id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
404 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
405 if (dpyinfo->bitmaps[id].refcount
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
406 && dpyinfo->bitmaps[id].file
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
407 && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data))
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 ++dpyinfo->bitmaps[id].refcount;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
410 return id + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
411 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
412 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
413
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
414 /* Search bitmap-file-path for the file, if appropriate. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
415 fd = openp (Vx_bitmap_file_path, file, "", &found, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
416 if (fd < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
417 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
418 close (fd);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
419
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
420 filename = (char *) XSTRING (found)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
421
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
422 hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
423
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
424 if (hinst == NULL)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
425 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
426
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
427
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
428 result = XReadBitmapFile (FRAME_WIN32_DISPLAY (f), FRAME_WIN32_WINDOW (f),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
429 filename, &width, &height, &bitmap, &xhot, &yhot);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
430 if (result != BitmapSuccess)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
431 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
432
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
433 id = x_allocate_bitmap_record (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
434 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
435 dpyinfo->bitmaps[id - 1].refcount = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
436 dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
437 dpyinfo->bitmaps[id - 1].depth = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
438 dpyinfo->bitmaps[id - 1].height = height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
439 dpyinfo->bitmaps[id - 1].width = width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
440 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data);
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 return id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
443 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
444 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
445
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
446 /* Remove reference to bitmap with id number ID. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
447
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
448 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
449 x_destroy_bitmap (f, id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
450 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
451 int id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
452 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
453 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
454
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
455 if (id > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
456 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
457 --dpyinfo->bitmaps[id - 1].refcount;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
458 if (dpyinfo->bitmaps[id - 1].refcount == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
459 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
460 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
461 DeleteObject (dpyinfo->bitmaps[id - 1].pixmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
462 if (dpyinfo->bitmaps[id - 1].file)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
463 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
464 free (dpyinfo->bitmaps[id - 1].file);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
465 dpyinfo->bitmaps[id - 1].file = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
466 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
467 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
468 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
469 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
470 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
471
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
472 /* Free all the bitmaps for the display specified by DPYINFO. */
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 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
475 x_destroy_all_bitmaps (dpyinfo)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
476 struct win32_display_info *dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
477 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
478 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
479 for (i = 0; i < dpyinfo->bitmaps_last; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
480 if (dpyinfo->bitmaps[i].refcount > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
481 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
482 DeleteObject (dpyinfo->bitmaps[i].pixmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
483 if (dpyinfo->bitmaps[i].file)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
484 free (dpyinfo->bitmaps[i].file);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
485 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
486 dpyinfo->bitmaps_last = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
487 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
488
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
489 /* Connect the frame-parameter names for Win32 frames
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
490 to the ways of passing the parameter values to the window system.
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 The name of a parameter, as a Lisp symbol,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
493 has an `x-frame-parameter' property which is an integer in Lisp
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
494 but can be interpreted as an `enum x_frame_parm' in C. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
495
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
496 enum x_frame_parm
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
497 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
498 X_PARM_FOREGROUND_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
499 X_PARM_BACKGROUND_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
500 X_PARM_MOUSE_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
501 X_PARM_CURSOR_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
502 X_PARM_BORDER_COLOR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
503 X_PARM_ICON_TYPE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
504 X_PARM_FONT,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
505 X_PARM_BORDER_WIDTH,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
506 X_PARM_INTERNAL_BORDER_WIDTH,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
507 X_PARM_NAME,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
508 X_PARM_AUTORAISE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
509 X_PARM_AUTOLOWER,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
510 X_PARM_VERT_SCROLL_BAR,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
511 X_PARM_VISIBILITY,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
512 X_PARM_MENU_BAR_LINES
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
513 };
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
516 struct x_frame_parm_table
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
517 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
518 char *name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
519 void (*setter)( /* struct frame *frame, Lisp_Object val, oldval */ );
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
520 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
521
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
522 void x_set_foreground_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
523 void x_set_background_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
524 void x_set_mouse_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
525 void x_set_cursor_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
526 void x_set_border_color ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
527 void x_set_cursor_type ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
528 void x_set_icon_type ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
529 void x_set_icon_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
530 void x_set_font ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
531 void x_set_border_width ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
532 void x_set_internal_border_width ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
533 void x_explicitly_set_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
534 void x_set_autoraise ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
535 void x_set_autolower ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
536 void x_set_vertical_scroll_bars ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
537 void x_set_visibility ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
538 void x_set_menu_bar_lines ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
539 void x_set_scroll_bar_width ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
540 void x_set_unsplittable ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
541
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
542 static struct x_frame_parm_table x_frame_parms[] =
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
543 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
544 "foreground-color", x_set_foreground_color,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
545 "background-color", x_set_background_color,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
546 "mouse-color", x_set_mouse_color,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
547 "cursor-color", x_set_cursor_color,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
548 "border-color", x_set_border_color,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
549 "cursor-type", x_set_cursor_type,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
550 "icon-type", x_set_icon_type,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
551 "icon-name", x_set_icon_name,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
552 "font", x_set_font,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
553 "border-width", x_set_border_width,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
554 "internal-border-width", x_set_internal_border_width,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
555 "name", x_explicitly_set_name,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
556 "auto-raise", x_set_autoraise,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
557 "auto-lower", x_set_autolower,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
558 "vertical-scroll-bars", x_set_vertical_scroll_bars,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
559 "visibility", x_set_visibility,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
560 "menu-bar-lines", x_set_menu_bar_lines,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
561 "scroll-bar-width", x_set_scroll_bar_width,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
562 "unsplittable", x_set_unsplittable,
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 /* Attach the `x-frame-parameter' properties to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
566 the Lisp symbol names of parameters relevant to Win32. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
567
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
568 init_x_parm_symbols ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
569 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
570 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
571
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
572 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
573 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
574 make_number (i));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
575 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
576
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
577 /* Change the parameters of FRAME as specified by ALIST.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
578 If a parameter is not specially recognized, do nothing;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
579 otherwise call the `x_set_...' function for that parameter. */
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 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
582 x_set_frame_parameters (f, alist)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
583 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
584 Lisp_Object alist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
585 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
586 Lisp_Object tail;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
587
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
588 /* If both of these parameters are present, it's more efficient to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
589 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
590 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
591 int width, height;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
592
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
593 /* Same here. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
594 Lisp_Object left, top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
595
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
596 /* Same with these. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
597 Lisp_Object icon_left, icon_top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
598
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
599 /* Record in these vectors all the parms specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
600 Lisp_Object *parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
601 Lisp_Object *values;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
602 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
603 int left_no_change = 0, top_no_change = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
604 int icon_left_no_change = 0, icon_top_no_change = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
605
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
606 i = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
607 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
608 i++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
609
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
610 parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
611 values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
612
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
613 /* Extract parm names and values into those vectors. */
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 i = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
616 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
617 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
618 Lisp_Object elt, prop, val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
619
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
620 elt = Fcar (tail);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
621 parms[i] = Fcar (elt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
622 values[i] = Fcdr (elt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
623 i++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
624 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
625
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
626 top = left = Qunbound;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
627 icon_left = icon_top = Qunbound;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
628
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
629 /* 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
630 width = FRAME_WIDTH (f);
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
631 height = FRAME_HEIGHT (f);
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
632
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
633 /* Now process them in reverse of specified order. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
634 for (i--; i >= 0; i--)
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 Lisp_Object prop, val;
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 prop = parms[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
639 val = values[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
640
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
641 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
642 width = XFASTINT (val);
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
643 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
644 height = XFASTINT (val);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
645 else if (EQ (prop, Qtop))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
646 top = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
647 else if (EQ (prop, Qleft))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
648 left = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
649 else if (EQ (prop, Qicon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
650 icon_top = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
651 else if (EQ (prop, Qicon_left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
652 icon_left = val;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
653 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
654 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
655 register Lisp_Object param_index, old_value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
656
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
657 param_index = Fget (prop, Qx_frame_parameter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
658 old_value = get_frame_param (f, prop);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
659 store_frame_param (f, prop, val);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
660 if (NATNUMP (param_index)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
661 && (XFASTINT (param_index)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
662 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0])))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
663 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value);
13434
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 }
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 /* Don't die if just one of these was set. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
668 if (EQ (left, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
669 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
670 left_no_change = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
671 if (f->output_data.win32->left_pos < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
672 left = Fcons (Qplus, Fcons (make_number (f->output_data.win32->left_pos), Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
673 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
674 XSETINT (left, f->output_data.win32->left_pos);
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 if (EQ (top, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
677 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
678 top_no_change = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
679 if (f->output_data.win32->top_pos < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
680 top = Fcons (Qplus, Fcons (make_number (f->output_data.win32->top_pos), Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
681 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
682 XSETINT (top, f->output_data.win32->top_pos);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
683 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
684
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
685 /* 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
686 if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left))
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 icon_left_no_change = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
689 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
690 if (NILP (icon_left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
691 XSETINT (icon_left, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
692 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
693 if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
694 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
695 icon_top_no_change = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
696 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
697 if (NILP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
698 XSETINT (icon_top, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
699 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
700
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
701 /* Don't set these parameters unless they've been explicitly
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
702 specified. The window might be mapped or resized while we're in
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
703 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
704 code has asked for it.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
705
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
706 Don't set these parameters unless they actually differ from the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
707 window's current parameters; the window may not actually exist
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
708 yet. */
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 Lisp_Object frame;
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 check_frame_size (f, &height, &width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
713
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
714 XSETFRAME (frame, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
715
16106
fdd1b2ade15d (x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents: 16089
diff changeset
716 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
717 || 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
718 Fset_frame_size (frame, make_number (width), make_number (height));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
719
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
720 if ((!NILP (left) || !NILP (top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
721 && ! (left_no_change && top_no_change)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
722 && ! (NUMBERP (left) && XINT (left) == f->output_data.win32->left_pos
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
723 && NUMBERP (top) && XINT (top) == f->output_data.win32->top_pos))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
724 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
725 int leftpos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
726 int toppos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
727
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
728 /* Record the signs. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
729 f->output_data.win32->size_hint_flags &= ~ (XNegative | YNegative);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
730 if (EQ (left, Qminus))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
731 f->output_data.win32->size_hint_flags |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
732 else if (INTEGERP (left))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
733 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
734 leftpos = XINT (left);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
735 if (leftpos < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
736 f->output_data.win32->size_hint_flags |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
737 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
738 else if (CONSP (left) && EQ (XCONS (left)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
739 && CONSP (XCONS (left)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
740 && INTEGERP (XCONS (XCONS (left)->cdr)->car))
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 leftpos = - XINT (XCONS (XCONS (left)->cdr)->car);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
743 f->output_data.win32->size_hint_flags |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
744 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
745 else if (CONSP (left) && EQ (XCONS (left)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
746 && CONSP (XCONS (left)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
747 && INTEGERP (XCONS (XCONS (left)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
748 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
749 leftpos = XINT (XCONS (XCONS (left)->cdr)->car);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
750 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
751
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
752 if (EQ (top, Qminus))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
753 f->output_data.win32->size_hint_flags |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
754 else if (INTEGERP (top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
755 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
756 toppos = XINT (top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
757 if (toppos < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
758 f->output_data.win32->size_hint_flags |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
759 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
760 else if (CONSP (top) && EQ (XCONS (top)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
761 && CONSP (XCONS (top)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
762 && INTEGERP (XCONS (XCONS (top)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
763 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
764 toppos = - XINT (XCONS (XCONS (top)->cdr)->car);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
765 f->output_data.win32->size_hint_flags |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
766 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
767 else if (CONSP (top) && EQ (XCONS (top)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
768 && CONSP (XCONS (top)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
769 && INTEGERP (XCONS (XCONS (top)->cdr)->car))
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 toppos = XINT (XCONS (XCONS (top)->cdr)->car);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
774
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
775 /* Store the numeric value of the position. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
776 f->output_data.win32->top_pos = toppos;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
777 f->output_data.win32->left_pos = leftpos;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
778
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
779 f->output_data.win32->win_gravity = NorthWestGravity;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
780
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
781 /* Actually set that position, and convert to absolute. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
782 x_set_offset (f, leftpos, toppos, -1);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
785 if ((!NILP (icon_left) || !NILP (icon_top))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
786 && ! (icon_left_no_change && icon_top_no_change))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
787 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
788 }
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 /* Store the screen positions of frame F into XPTR and YPTR.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
792 These are the positions of the containing window manager window,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
793 not Emacs's own window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
794
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
795 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
796 x_real_positions (f, xptr, yptr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
797 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
798 int *xptr, *yptr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
799 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
800 POINT pt;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
801
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
802 {
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
803 RECT rect;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
804
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
805 GetClientRect(FRAME_WIN32_WINDOW(f), &rect);
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
806 AdjustWindowRect(&rect, f->output_data.win32->dwStyle, FRAME_EXTERNAL_MENU_BAR(f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
807
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
808 pt.x = rect.left;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
809 pt.y = rect.top;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
810 }
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
811
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
812 ClientToScreen (FRAME_WIN32_WINDOW(f), &pt);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
813
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
814 *xptr = pt.x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
815 *yptr = pt.y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
816 }
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 /* Insert a description of internally-recorded parameters of frame X
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
819 into the parameter alist *ALISTPTR that is to be given to the user.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
820 Only parameters that are specific to Win32
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
821 and whose values are not correctly recorded in the frame's
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
822 param_alist need to be considered here. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
823
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
824 x_report_frame_params (f, alistptr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
825 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
826 Lisp_Object *alistptr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
827 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
828 char buf[16];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
829 Lisp_Object tem;
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 /* Represent negative positions (off the top or left screen edge)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
832 in a way that Fmodify_frame_parameters will understand correctly. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
833 XSETINT (tem, f->output_data.win32->left_pos);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
834 if (f->output_data.win32->left_pos >= 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
835 store_in_alist (alistptr, Qleft, tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
836 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
837 store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
838
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
839 XSETINT (tem, f->output_data.win32->top_pos);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
840 if (f->output_data.win32->top_pos >= 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
841 store_in_alist (alistptr, Qtop, tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
842 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
843 store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
844
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
845 store_in_alist (alistptr, Qborder_width,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
846 make_number (f->output_data.win32->border_width));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
847 store_in_alist (alistptr, Qinternal_border_width,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
848 make_number (f->output_data.win32->internal_border_width));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
849 sprintf (buf, "%ld", (long) FRAME_WIN32_WINDOW (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
850 store_in_alist (alistptr, Qwindow_id,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
851 build_string (buf));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
852 store_in_alist (alistptr, Qicon_name, f->icon_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
853 FRAME_SAMPLE_VISIBILITY (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
854 store_in_alist (alistptr, Qvisibility,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
855 (FRAME_VISIBLE_P (f) ? Qt
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
856 : FRAME_ICONIFIED_P (f) ? Qicon : Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
857 store_in_alist (alistptr, Qdisplay,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
858 XCONS (FRAME_WIN32_DISPLAY_INFO (f)->name_list_element)->car);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
859 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
860
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
861
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
862 DEFUN ("win32-define-rgb-color", Fwin32_define_rgb_color, Swin32_define_rgb_color, 4, 4, 0,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
863 "Convert RGB numbers to a windows color reference and associate with NAME (a string).\n\
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
864 This adds or updates a named color to win32-color-map, making it available for use.\n\
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
865 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
866 (red, green, blue, name)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
867 Lisp_Object red, green, blue, name;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
868 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
869 Lisp_Object rgb;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
870 Lisp_Object oldrgb = Qnil;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
871 Lisp_Object entry;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
872
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
873 CHECK_NUMBER (red, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
874 CHECK_NUMBER (green, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
875 CHECK_NUMBER (blue, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
876 CHECK_STRING (name, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
877
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
878 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
879
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
880 BLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
881
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
882 /* replace existing entry in win32-color-map or add new entry. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
883 entry = Fassoc (name, Vwin32_color_map);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
884 if (NILP (entry))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
885 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
886 entry = Fcons (name, rgb);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
887 Vwin32_color_map = Fcons (entry, Vwin32_color_map);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
888 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
889 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
890 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
891 oldrgb = Fcdr (entry);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
892 Fsetcdr (entry, rgb);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
893 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
894
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
895 UNBLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
896
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
897 return (oldrgb);
13434
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
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
900 DEFUN ("win32-load-color-file", Fwin32_load_color_file, Swin32_load_color_file, 1, 1, 0,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
901 "Create an alist of color entries from an external file (ie. rgb.txt).\n\
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
902 Assign this value to win32-color-map to replace the existing color map.\n\
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
903 \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
904 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
905 R G B name\n\
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
906 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
907 (filename)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
908 Lisp_Object filename;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
909 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
910 FILE *fp;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
911 Lisp_Object cmap = Qnil;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
912 Lisp_Object abspath;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
913
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
914 CHECK_STRING (filename, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
915 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
916
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
917 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
918 if (fp)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
919 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
920 char buf[512];
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
921 int red, green, blue;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
922 int num;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
923
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
924 BLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
925
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
926 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
927 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
928 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
929 char *name = buf + num;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
930 num = strlen (name) - 1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
931 if (name[num] == '\n')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
932 name[num] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
933 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
934 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
935 cmap);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
936 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
937 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
938 fclose (fp);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
939
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
940 UNBLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
941 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
942
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
943 return cmap;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
944 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
945
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
946 /* The default colors for the win32 color map */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
947 typedef struct colormap_t
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
948 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
949 char *name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
950 COLORREF colorref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
951 } colormap_t;
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 colormap_t win32_color_map[] =
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
954 {
14983
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
955 {"snow" , PALETTERGB (255,250,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
956 {"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
957 {"GhostWhite" , PALETTERGB (248,248,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
958 {"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
959 {"WhiteSmoke" , PALETTERGB (245,245,245)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
960 {"gainsboro" , PALETTERGB (220,220,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
961 {"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
962 {"FloralWhite" , PALETTERGB (255,250,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
963 {"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
964 {"OldLace" , PALETTERGB (253,245,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
965 {"linen" , PALETTERGB (250,240,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
966 {"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
967 {"AntiqueWhite" , PALETTERGB (250,235,215)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
968 {"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
969 {"PapayaWhip" , PALETTERGB (255,239,213)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
970 {"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
971 {"BlanchedAlmond" , PALETTERGB (255,235,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
972 {"bisque" , PALETTERGB (255,228,196)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
973 {"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
974 {"PeachPuff" , PALETTERGB (255,218,185)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
975 {"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
976 {"NavajoWhite" , PALETTERGB (255,222,173)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
977 {"moccasin" , PALETTERGB (255,228,181)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
978 {"cornsilk" , PALETTERGB (255,248,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
979 {"ivory" , PALETTERGB (255,255,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
980 {"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
981 {"LemonChiffon" , PALETTERGB (255,250,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
982 {"seashell" , PALETTERGB (255,245,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
983 {"honeydew" , PALETTERGB (240,255,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
984 {"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
985 {"MintCream" , PALETTERGB (245,255,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
986 {"azure" , PALETTERGB (240,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
987 {"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
988 {"AliceBlue" , PALETTERGB (240,248,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
989 {"lavender" , PALETTERGB (230,230,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
990 {"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
991 {"LavenderBlush" , PALETTERGB (255,240,245)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
992 {"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
993 {"MistyRose" , PALETTERGB (255,228,225)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
994 {"white" , PALETTERGB (255,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
995 {"black" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
996 {"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
997 {"DarkSlateGray" , PALETTERGB ( 47, 79, 79)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
998 {"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
999 {"DarkSlateGrey" , PALETTERGB ( 47, 79, 79)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1000 {"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
1001 {"DimGray" , PALETTERGB (105,105,105)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1002 {"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
1003 {"DimGrey" , PALETTERGB (105,105,105)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1004 {"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
1005 {"SlateGray" , PALETTERGB (112,128,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1006 {"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
1007 {"SlateGrey" , PALETTERGB (112,128,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1008 {"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
1009 {"LightSlateGray" , PALETTERGB (119,136,153)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1010 {"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
1011 {"LightSlateGrey" , PALETTERGB (119,136,153)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1012 {"gray" , PALETTERGB (190,190,190)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1013 {"grey" , PALETTERGB (190,190,190)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1014 {"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
1015 {"LightGrey" , PALETTERGB (211,211,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1016 {"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
1017 {"LightGray" , PALETTERGB (211,211,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1018 {"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
1019 {"MidnightBlue" , PALETTERGB ( 25, 25,112)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1020 {"navy" , PALETTERGB ( 0, 0,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1021 {"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
1022 {"NavyBlue" , PALETTERGB ( 0, 0,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1023 {"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
1024 {"CornflowerBlue" , PALETTERGB (100,149,237)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1025 {"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
1026 {"DarkSlateBlue" , PALETTERGB ( 72, 61,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1027 {"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
1028 {"SlateBlue" , PALETTERGB (106, 90,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1029 {"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
1030 {"MediumSlateBlue" , PALETTERGB (123,104,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1031 {"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
1032 {"LightSlateBlue" , PALETTERGB (132,112,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1033 {"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
1034 {"MediumBlue" , PALETTERGB ( 0, 0,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1035 {"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
1036 {"RoyalBlue" , PALETTERGB ( 65,105,225)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1037 {"blue" , PALETTERGB ( 0, 0,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1038 {"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
1039 {"DodgerBlue" , PALETTERGB ( 30,144,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1040 {"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
1041 {"DeepSkyBlue" , PALETTERGB ( 0,191,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1042 {"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
1043 {"SkyBlue" , PALETTERGB (135,206,235)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1044 {"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
1045 {"LightSkyBlue" , PALETTERGB (135,206,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1046 {"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
1047 {"SteelBlue" , PALETTERGB ( 70,130,180)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1048 {"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
1049 {"LightSteelBlue" , PALETTERGB (176,196,222)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1050 {"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
1051 {"LightBlue" , PALETTERGB (173,216,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1052 {"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
1053 {"PowderBlue" , PALETTERGB (176,224,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1054 {"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
1055 {"PaleTurquoise" , PALETTERGB (175,238,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1056 {"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
1057 {"DarkTurquoise" , PALETTERGB ( 0,206,209)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1058 {"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
1059 {"MediumTurquoise" , PALETTERGB ( 72,209,204)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1060 {"turquoise" , PALETTERGB ( 64,224,208)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1061 {"cyan" , PALETTERGB ( 0,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1062 {"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
1063 {"LightCyan" , PALETTERGB (224,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1064 {"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
1065 {"CadetBlue" , PALETTERGB ( 95,158,160)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1066 {"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
1067 {"MediumAquamarine" , PALETTERGB (102,205,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1068 {"aquamarine" , PALETTERGB (127,255,212)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1069 {"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
1070 {"DarkGreen" , PALETTERGB ( 0,100, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1071 {"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
1072 {"DarkOliveGreen" , PALETTERGB ( 85,107, 47)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1073 {"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
1074 {"DarkSeaGreen" , PALETTERGB (143,188,143)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1075 {"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
1076 {"SeaGreen" , PALETTERGB ( 46,139, 87)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1077 {"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
1078 {"MediumSeaGreen" , PALETTERGB ( 60,179,113)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1079 {"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
1080 {"LightSeaGreen" , PALETTERGB ( 32,178,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1081 {"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
1082 {"PaleGreen" , PALETTERGB (152,251,152)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1083 {"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
1084 {"SpringGreen" , PALETTERGB ( 0,255,127)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1085 {"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
1086 {"LawnGreen" , PALETTERGB (124,252, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1087 {"green" , PALETTERGB ( 0,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1088 {"chartreuse" , PALETTERGB (127,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1089 {"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
1090 {"MediumSpringGreen" , PALETTERGB ( 0,250,154)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1091 {"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
1092 {"GreenYellow" , PALETTERGB (173,255, 47)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1093 {"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
1094 {"LimeGreen" , PALETTERGB ( 50,205, 50)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1095 {"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
1096 {"YellowGreen" , PALETTERGB (154,205, 50)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1097 {"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
1098 {"ForestGreen" , PALETTERGB ( 34,139, 34)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1099 {"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
1100 {"OliveDrab" , PALETTERGB (107,142, 35)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1101 {"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
1102 {"DarkKhaki" , PALETTERGB (189,183,107)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1103 {"khaki" , PALETTERGB (240,230,140)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1104 {"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
1105 {"PaleGoldenrod" , PALETTERGB (238,232,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1106 {"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
1107 {"LightGoldenrodYellow" , PALETTERGB (250,250,210)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1108 {"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
1109 {"LightYellow" , PALETTERGB (255,255,224)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1110 {"yellow" , PALETTERGB (255,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1111 {"gold" , PALETTERGB (255,215, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1112 {"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
1113 {"LightGoldenrod" , PALETTERGB (238,221,130)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1114 {"goldenrod" , PALETTERGB (218,165, 32)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1115 {"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
1116 {"DarkGoldenrod" , PALETTERGB (184,134, 11)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1117 {"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
1118 {"RosyBrown" , PALETTERGB (188,143,143)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1119 {"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
1120 {"IndianRed" , PALETTERGB (205, 92, 92)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1121 {"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
1122 {"SaddleBrown" , PALETTERGB (139, 69, 19)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1123 {"sienna" , PALETTERGB (160, 82, 45)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1124 {"peru" , PALETTERGB (205,133, 63)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1125 {"burlywood" , PALETTERGB (222,184,135)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1126 {"beige" , PALETTERGB (245,245,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1127 {"wheat" , PALETTERGB (245,222,179)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1128 {"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
1129 {"SandyBrown" , PALETTERGB (244,164, 96)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1130 {"tan" , PALETTERGB (210,180,140)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1131 {"chocolate" , PALETTERGB (210,105, 30)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1132 {"firebrick" , PALETTERGB (178,34, 34)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1133 {"brown" , PALETTERGB (165,42, 42)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1134 {"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
1135 {"DarkSalmon" , PALETTERGB (233,150,122)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1136 {"salmon" , PALETTERGB (250,128,114)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1137 {"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
1138 {"LightSalmon" , PALETTERGB (255,160,122)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1139 {"orange" , PALETTERGB (255,165, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1140 {"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
1141 {"DarkOrange" , PALETTERGB (255,140, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1142 {"coral" , PALETTERGB (255,127, 80)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1143 {"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
1144 {"LightCoral" , PALETTERGB (240,128,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1145 {"tomato" , PALETTERGB (255, 99, 71)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1146 {"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
1147 {"OrangeRed" , PALETTERGB (255, 69, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1148 {"red" , PALETTERGB (255, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1149 {"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
1150 {"HotPink" , PALETTERGB (255,105,180)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1151 {"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
1152 {"DeepPink" , PALETTERGB (255, 20,147)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1153 {"pink" , PALETTERGB (255,192,203)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1154 {"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
1155 {"LightPink" , PALETTERGB (255,182,193)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1156 {"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
1157 {"PaleVioletRed" , PALETTERGB (219,112,147)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1158 {"maroon" , PALETTERGB (176, 48, 96)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1159 {"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
1160 {"MediumVioletRed" , PALETTERGB (199, 21,133)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1161 {"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
1162 {"VioletRed" , PALETTERGB (208, 32,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1163 {"magenta" , PALETTERGB (255, 0,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1164 {"violet" , PALETTERGB (238,130,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1165 {"plum" , PALETTERGB (221,160,221)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1166 {"orchid" , PALETTERGB (218,112,214)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1167 {"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
1168 {"MediumOrchid" , PALETTERGB (186, 85,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1169 {"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
1170 {"DarkOrchid" , PALETTERGB (153, 50,204)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1171 {"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
1172 {"DarkViolet" , PALETTERGB (148, 0,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1173 {"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
1174 {"BlueViolet" , PALETTERGB (138, 43,226)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1175 {"purple" , PALETTERGB (160, 32,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1176 {"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
1177 {"MediumPurple" , PALETTERGB (147,112,219)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1178 {"thistle" , PALETTERGB (216,191,216)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1179 {"gray0" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1180 {"grey0" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1181 {"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
1182 {"DarkGrey" , PALETTERGB (169,169,169)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1183 {"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
1184 {"DarkGray" , PALETTERGB (169,169,169)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1185 {"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
1186 {"DarkBlue" , PALETTERGB ( 0, 0,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1187 {"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
1188 {"DarkCyan" , PALETTERGB ( 0,139,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1189 {"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
1190 {"DarkMagenta" , PALETTERGB (139, 0,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1191 {"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
1192 {"DarkRed" , PALETTERGB (139, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
1193 {"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
1194 {"LightGreen" , PALETTERGB (144,238,144)},
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1195 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1196
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1197 DEFUN ("win32-default-color-map", Fwin32_default_color_map, Swin32_default_color_map,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1198 0, 0, 0, "Return the default color map.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1199 ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1200 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1201 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1202 colormap_t *pc = win32_color_map;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1203 Lisp_Object cmap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1204
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1205 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1206
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1207 cmap = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1208
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1209 for (i = 0; i < sizeof (win32_color_map) / sizeof (win32_color_map[0]);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1210 pc++, i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1211 cmap = Fcons (Fcons (build_string (pc->name),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1212 make_number (pc->colorref)),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1213 cmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1214
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1215 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1216
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1217 return (cmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1218 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1219
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1220 Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1221 win32_to_x_color (rgb)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1222 Lisp_Object rgb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1223 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1224 Lisp_Object color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1225
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1226 CHECK_NUMBER (rgb, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1227
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1228 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1229
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1230 color = Frassq (rgb, Vwin32_color_map);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1231
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1232 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1233
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1234 if (!NILP (color))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1235 return (Fcar (color));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1236 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1237 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1238 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1239
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1240 COLORREF
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1241 x_to_win32_color (colorname)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1242 char * colorname;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1243 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1244 register Lisp_Object tail, ret = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1245
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1246 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1247
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1248 for (tail = Vwin32_color_map; !NILP (tail); tail = Fcdr (tail))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1249 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1250 register Lisp_Object elt, tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1251
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1252 elt = Fcar (tail);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1253 if (!CONSP (elt)) continue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1254
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1255 tem = Fcar (elt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1256
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1257 if (lstrcmpi (XSTRING (tem)->data, colorname) == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1258 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1259 ret = XUINT(Fcdr (elt));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1260 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1261 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1262
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1263 QUIT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1264 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1265
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1266 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1267
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1268 return ret;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1269 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1270
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1271
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1272 void
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1273 win32_regenerate_palette (FRAME_PTR f)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1274 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1275 struct win32_palette_entry * list;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1276 LOGPALETTE * log_palette;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1277 HPALETTE new_palette;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1278 int i;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1279
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1280 /* don't bother trying to create palette if not supported */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1281 if (! FRAME_WIN32_DISPLAY_INFO (f)->has_palette)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1282 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1283
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1284 log_palette = (LOGPALETTE *)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1285 alloca (sizeof (LOGPALETTE) +
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1286 FRAME_WIN32_DISPLAY_INFO (f)->num_colors * sizeof (PALETTEENTRY));
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1287 log_palette->palVersion = 0x300;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1288 log_palette->palNumEntries = FRAME_WIN32_DISPLAY_INFO (f)->num_colors;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1289
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1290 list = FRAME_WIN32_DISPLAY_INFO (f)->color_list;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1291 for (i = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1292 i < FRAME_WIN32_DISPLAY_INFO (f)->num_colors;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1293 i++, list = list->next)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1294 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
1295
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1296 new_palette = CreatePalette (log_palette);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1297
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1298 enter_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1299
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1300 if (FRAME_WIN32_DISPLAY_INFO (f)->palette)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1301 DeleteObject (FRAME_WIN32_DISPLAY_INFO (f)->palette);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1302 FRAME_WIN32_DISPLAY_INFO (f)->palette = new_palette;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1303
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1304 /* 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
1305 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
1306
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1307 leave_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1308 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1309
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1310 #define WIN32_COLOR(pe) RGB (pe.peRed, pe.peGreen, pe.peBlue)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1311 #define SET_WIN32_COLOR(pe, color) \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1312 do \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1313 { \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1314 pe.peRed = GetRValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1315 pe.peGreen = GetGValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1316 pe.peBlue = GetBValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1317 pe.peFlags = 0; \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1318 } while (0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1319
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1320 #if 0
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1321 /* 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
1322 void
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1323 win32_map_color (FRAME_PTR f, COLORREF color)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1324 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1325 struct win32_palette_entry * list = FRAME_WIN32_DISPLAY_INFO (f)->color_list;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1326
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1327 if (NILP (Vwin32_enable_palette))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1328 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1329
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1330 /* 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
1331 while (list)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1332 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1333 if (WIN32_COLOR (list->entry) == color)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1334 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1335 ++list->refcount;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1336 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1337 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1338 list = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1339 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1340
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1341 /* not already mapped, so add to list and recreate Windows palette */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1342 list = (struct win32_palette_entry *)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1343 xmalloc (sizeof (struct win32_palette_entry));
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1344 SET_WIN32_COLOR (list->entry, color);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1345 list->refcount = 1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1346 list->next = FRAME_WIN32_DISPLAY_INFO (f)->color_list;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1347 FRAME_WIN32_DISPLAY_INFO (f)->color_list = list;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1348 FRAME_WIN32_DISPLAY_INFO (f)->num_colors++;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1349
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1350 /* set flag that palette must be regenerated */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1351 FRAME_WIN32_DISPLAY_INFO (f)->regen_palette = TRUE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1352 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1353
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1354 void
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1355 win32_unmap_color (FRAME_PTR f, COLORREF color)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1356 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1357 struct win32_palette_entry * list = FRAME_WIN32_DISPLAY_INFO (f)->color_list;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1358 struct win32_palette_entry **prev = &FRAME_WIN32_DISPLAY_INFO (f)->color_list;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1359
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1360 if (NILP (Vwin32_enable_palette))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1361 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1362
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1363 /* 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
1364 while (list)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1365 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1366 if (WIN32_COLOR (list->entry) == color)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1367 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1368 if (--list->refcount == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1369 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1370 *prev = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1371 xfree (list);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1372 FRAME_WIN32_DISPLAY_INFO (f)->num_colors--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1373 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1374 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1375 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1376 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1377 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1378 prev = &list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1379 list = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1380 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1381
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1382 /* set flag that palette must be regenerated */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1383 FRAME_WIN32_DISPLAY_INFO (f)->regen_palette = TRUE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1384 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1385 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1386
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1387 /* Decide if color named COLOR is valid for the display associated with
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1388 the selected frame; if so, return the rgb values in COLOR_DEF.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1389 If ALLOC is nonzero, allocate a new colormap cell. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1390
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1391 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1392 defined_color (f, color, color_def, alloc)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1393 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1394 char *color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1395 COLORREF *color_def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1396 int alloc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1397 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1398 register Lisp_Object tem;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1399
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1400 tem = x_to_win32_color (color);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1401
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1402 if (!NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1403 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1404 if (!NILP (Vwin32_enable_palette))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1405 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1406 struct win32_palette_entry * entry =
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1407 FRAME_WIN32_DISPLAY_INFO (f)->color_list;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1408 struct win32_palette_entry ** prev =
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1409 &FRAME_WIN32_DISPLAY_INFO (f)->color_list;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1410
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1411 /* 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
1412 while (entry)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1413 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1414 if (WIN32_COLOR (entry->entry) == XUINT (tem))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1415 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1416 prev = &entry->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1417 entry = entry->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1418 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1419
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1420 if (entry == NULL && alloc)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1421 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1422 /* not already mapped, so add to list */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1423 entry = (struct win32_palette_entry *)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1424 xmalloc (sizeof (struct win32_palette_entry));
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1425 SET_WIN32_COLOR (entry->entry, XUINT (tem));
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1426 entry->next = NULL;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1427 *prev = entry;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1428 FRAME_WIN32_DISPLAY_INFO (f)->num_colors++;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1429
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1430 /* set flag that palette must be regenerated */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1431 FRAME_WIN32_DISPLAY_INFO (f)->regen_palette = TRUE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1432 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1433 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1434 /* 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
1435 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
1436 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
1437 *color_def = XUINT (tem) | 0x2000000;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1438 return 1;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1439 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1440 else
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1441 {
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1442 return 0;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1443 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1444 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1445
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1446 /* 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
1447 suitable for screen F.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1448 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
1449 ARG says. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1450
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1451 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1452 x_decode_color (f, arg, def)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1453 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1454 Lisp_Object arg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1455 int def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1456 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1457 COLORREF cdef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1458
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1459 CHECK_STRING (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1460
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1461 if (strcmp (XSTRING (arg)->data, "black") == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1462 return BLACK_PIX_DEFAULT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1463 else if (strcmp (XSTRING (arg)->data, "white") == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1464 return WHITE_PIX_DEFAULT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1465
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1466 if ((FRAME_WIN32_DISPLAY_INFO (f)->n_planes * FRAME_WIN32_DISPLAY_INFO (f)->n_cbits) == 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1467 return def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1468
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1469 /* defined_color is responsible for coping with failures
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1470 by looking for a near-miss. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1471 if (defined_color (f, XSTRING (arg)->data, &cdef, 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1472 return cdef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1473
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1474 /* defined_color failed; return an ultimate default. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1475 return def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1476 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1477
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1478 /* Functions called only from `x_set_frame_param'
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1479 to set individual parameters.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1480
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1481 If FRAME_WIN32_WINDOW (f) is 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1482 the frame is being created and its window does not exist yet.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1483 In that case, just record the parameter's new value
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1484 in the standard place; do not attempt to change the window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1485
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1486 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1487 x_set_foreground_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1488 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1489 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1490 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1491 f->output_data.win32->foreground_pixel
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1492 = 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
1493
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1494 if (FRAME_WIN32_WINDOW (f) != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1495 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1496 recompute_basic_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1497 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1498 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1499 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1500 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1501
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1502 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1503 x_set_background_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1504 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1505 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1506 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1507 Pixmap temp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1508 int mask;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1509
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1510 f->output_data.win32->background_pixel
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1511 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1512
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1513 if (FRAME_WIN32_WINDOW (f) != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1514 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1515 SetWindowLong (FRAME_WIN32_WINDOW (f), WND_BACKGROUND_INDEX, f->output_data.win32->background_pixel);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1516
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1517 recompute_basic_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1518
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1519 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1520 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1521 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1522 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1523
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1524 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1525 x_set_mouse_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1526 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1527 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1528 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1529 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1530 Cursor cursor, nontext_cursor, mode_cursor, cross_cursor;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1531 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1532 int mask_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1533
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1534 if (!EQ (Qnil, arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1535 f->output_data.win32->mouse_pixel
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1536 = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1537 mask_color = f->output_data.win32->background_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1538 /* No invisible pointers. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1539 if (mask_color == f->output_data.win32->mouse_pixel
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1540 && mask_color == f->output_data.win32->background_pixel)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1541 f->output_data.win32->mouse_pixel = f->output_data.win32->foreground_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1542
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1543 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1544 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1545
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1546 /* It's not okay to crash if the user selects a screwy cursor. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1547 x_catch_errors (FRAME_WIN32_DISPLAY (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1548
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1549 if (!EQ (Qnil, Vx_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1550 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1551 CHECK_NUMBER (Vx_pointer_shape, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1552 cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XINT (Vx_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1553 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1554 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1555 cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XC_xterm);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1556 x_check_errors (FRAME_WIN32_DISPLAY (f), "bad text pointer cursor: %s");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1557
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1558 if (!EQ (Qnil, Vx_nontext_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1559 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1560 CHECK_NUMBER (Vx_nontext_pointer_shape, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1561 nontext_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1562 XINT (Vx_nontext_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1563 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1564 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1565 nontext_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XC_left_ptr);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1566 x_check_errors (FRAME_WIN32_DISPLAY (f), "bad nontext pointer cursor: %s");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1567
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1568 if (!EQ (Qnil, Vx_mode_pointer_shape))
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 CHECK_NUMBER (Vx_mode_pointer_shape, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1571 mode_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1572 XINT (Vx_mode_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1573 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1574 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1575 mode_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XC_xterm);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1576 x_check_errors (FRAME_WIN32_DISPLAY (f), "bad modeline pointer cursor: %s");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1577
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1578 if (!EQ (Qnil, Vx_sensitive_text_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1579 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1580 CHECK_NUMBER (Vx_sensitive_text_pointer_shape, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1581 cross_cursor
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1582 = XCreateFontCursor (FRAME_WIN32_DISPLAY (f),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1583 XINT (Vx_sensitive_text_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1584 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1585 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1586 cross_cursor = XCreateFontCursor (FRAME_WIN32_DISPLAY (f), XC_crosshair);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1587
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1588 /* Check and report errors with the above calls. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1589 x_check_errors (FRAME_WIN32_DISPLAY (f), "can't set cursor shape: %s");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1590 x_uncatch_errors (FRAME_WIN32_DISPLAY (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1591
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1592 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1593 XColor fore_color, back_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1594
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1595 fore_color.pixel = f->output_data.win32->mouse_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1596 back_color.pixel = mask_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1597 XQueryColor (FRAME_WIN32_DISPLAY (f),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1598 DefaultColormap (FRAME_WIN32_DISPLAY (f),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1599 DefaultScreen (FRAME_WIN32_DISPLAY (f))),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1600 &fore_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1601 XQueryColor (FRAME_WIN32_DISPLAY (f),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1602 DefaultColormap (FRAME_WIN32_DISPLAY (f),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1603 DefaultScreen (FRAME_WIN32_DISPLAY (f))),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1604 &back_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1605 XRecolorCursor (FRAME_WIN32_DISPLAY (f), cursor,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1606 &fore_color, &back_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1607 XRecolorCursor (FRAME_WIN32_DISPLAY (f), nontext_cursor,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1608 &fore_color, &back_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1609 XRecolorCursor (FRAME_WIN32_DISPLAY (f), mode_cursor,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1610 &fore_color, &back_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1611 XRecolorCursor (FRAME_WIN32_DISPLAY (f), cross_cursor,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1612 &fore_color, &back_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1613 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1614
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1615 if (FRAME_WIN32_WINDOW (f) != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1616 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1617 XDefineCursor (FRAME_WIN32_DISPLAY (f), FRAME_WIN32_WINDOW (f), cursor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1618 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1619
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1620 if (cursor != f->output_data.win32->text_cursor && f->output_data.win32->text_cursor != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1621 XFreeCursor (FRAME_WIN32_DISPLAY (f), f->output_data.win32->text_cursor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1622 f->output_data.win32->text_cursor = cursor;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1623
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1624 if (nontext_cursor != f->output_data.win32->nontext_cursor
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1625 && f->output_data.win32->nontext_cursor != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1626 XFreeCursor (FRAME_WIN32_DISPLAY (f), f->output_data.win32->nontext_cursor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1627 f->output_data.win32->nontext_cursor = nontext_cursor;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1628
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1629 if (mode_cursor != f->output_data.win32->modeline_cursor
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1630 && f->output_data.win32->modeline_cursor != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1631 XFreeCursor (FRAME_WIN32_DISPLAY (f), f->output_data.win32->modeline_cursor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1632 f->output_data.win32->modeline_cursor = mode_cursor;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1633 if (cross_cursor != f->output_data.win32->cross_cursor
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1634 && f->output_data.win32->cross_cursor != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1635 XFreeCursor (FRAME_WIN32_DISPLAY (f), f->output_data.win32->cross_cursor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1636 f->output_data.win32->cross_cursor = cross_cursor;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1637
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1638 XFlush (FRAME_WIN32_DISPLAY (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1639 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1640 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1641 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1642
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1643 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1644 x_set_cursor_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1645 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1646 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1647 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1648 unsigned long fore_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1649
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1650 if (!EQ (Vx_cursor_fore_pixel, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1651 fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1652 WHITE_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1653 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1654 fore_pixel = f->output_data.win32->background_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1655 f->output_data.win32->cursor_pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1656
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1657 /* Make sure that the cursor color differs from the background color. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1658 if (f->output_data.win32->cursor_pixel == f->output_data.win32->background_pixel)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1659 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1660 f->output_data.win32->cursor_pixel = f->output_data.win32->mouse_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1661 if (f->output_data.win32->cursor_pixel == fore_pixel)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1662 fore_pixel = f->output_data.win32->background_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1663 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1664 f->output_data.win32->cursor_foreground_pixel = fore_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1665
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1666 if (FRAME_WIN32_WINDOW (f) != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1667 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1668 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1669 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1670 x_display_cursor (f, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1671 x_display_cursor (f, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1672 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1673 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1674 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1675
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1676 /* Set the border-color of frame F to value described by ARG.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1677 ARG can be a string naming a color.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1678 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
1679 Note that this does not fully take effect if done before
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1680 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
1681
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1682 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1683 x_set_border_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1684 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1685 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1686 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1687 unsigned char *str;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1688 int pix;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1689
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1690 CHECK_STRING (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1691 str = XSTRING (arg)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1692
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1693 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1694
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1695 x_set_border_pixel (f, pix);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1696 }
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 /* Set the border-color of frame F to pixel value PIX.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1699 Note that this does not fully take effect if done before
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1700 F has an window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1701
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1702 x_set_border_pixel (f, pix)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1703 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1704 int pix;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1705 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1706 f->output_data.win32->border_pixel = pix;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1707
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1708 if (FRAME_WIN32_WINDOW (f) != 0 && f->output_data.win32->border_width > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1709 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1710 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1711 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1712 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1713 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1714
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1715 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1716 x_set_cursor_type (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1717 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1718 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1719 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1720 if (EQ (arg, Qbar))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1721 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1722 FRAME_DESIRED_CURSOR (f) = bar_cursor;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1723 f->output_data.win32->cursor_width = 2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1724 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1725 else if (CONSP (arg) && EQ (XCONS (arg)->car, Qbar)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1726 && INTEGERP (XCONS (arg)->cdr))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1727 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1728 FRAME_DESIRED_CURSOR (f) = bar_cursor;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1729 f->output_data.win32->cursor_width = XINT (XCONS (arg)->cdr);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1730 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1731 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1732 /* Treat anything unknown as "box cursor".
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1733 It was bad to signal an error; people have trouble fixing
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1734 .Xdefaults with Emacs, when it has something bad in it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1735 FRAME_DESIRED_CURSOR (f) = filled_box_cursor;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1736
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1737 /* Make sure the cursor gets redrawn. This is overkill, but how
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1738 often do people change cursor types? */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1739 update_mode_lines++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1740 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1741
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1742 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1743 x_set_icon_type (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1744 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1745 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1746 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1747 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1748 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1749 int result;
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 if (STRINGP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1752 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1753 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1754 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1755 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1756 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1757 return;
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 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1760 if (NILP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1761 result = x_text_icon (f,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1762 (char *) XSTRING ((!NILP (f->icon_name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1763 ? f->icon_name
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1764 : f->name))->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1765 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1766 result = x_bitmap_icon (f, arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1767
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1768 if (result)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1769 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1770 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1771 error ("No icon window available");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1772 }
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 /* If the window was unmapped (and its icon was mapped),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1775 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
1776 if (FRAME_VISIBLE_P (f))
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 #ifdef USE_X_TOOLKIT
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1779 XtPopup (f->output_data.win32->widget, XtGrabNone);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1780 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1781 XMapWindow (FRAME_WIN32_DISPLAY (f), FRAME_WIN32_WINDOW (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1782 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1783
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1784 XFlush (FRAME_WIN32_DISPLAY (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1785 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1786 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1787 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1788
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1789 /* Return non-nil if frame F wants a bitmap icon. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1790
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1791 Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1792 x_icon_type (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1793 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1794 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1795 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1796
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1797 tem = assq_no_quit (Qicon_type, f->param_alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1798 if (CONSP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1799 return XCONS (tem)->cdr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1800 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1801 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1802 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1803
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1804 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1805 x_set_icon_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1806 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1807 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1808 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1809 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1810 int result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1811
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1812 if (STRINGP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1813 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1814 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1815 return;
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 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1818 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1819
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1820 f->icon_name = arg;
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 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1823 if (f->output_data.win32->icon_bitmap != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1824 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1825
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1826 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1827
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1828 result = x_text_icon (f,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1829 (char *) XSTRING ((!NILP (f->icon_name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1830 ? f->icon_name
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1831 : f->name))->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1832
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1833 if (result)
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 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1836 error ("No icon window available");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1837 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1838
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1839 /* If the window was unmapped (and its icon was mapped),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1840 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
1841 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1842 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1843 #ifdef USE_X_TOOLKIT
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1844 XtPopup (f->output_data.win32->widget, XtGrabNone);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1845 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1846 XMapWindow (FRAME_WIN32_DISPLAY (f), FRAME_WIN32_WINDOW (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1847 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1848
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1849 XFlush (FRAME_WIN32_DISPLAY (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1850 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1851 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1852 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1853
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1854 extern Lisp_Object x_new_font ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1855
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1856 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1857 x_set_font (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1858 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1859 Lisp_Object arg, oldval;
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 Lisp_Object result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1862
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1863 CHECK_STRING (arg, 1);
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 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1866 result = x_new_font (f, XSTRING (arg)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1867 UNBLOCK_INPUT;
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 (result, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1870 error ("Font \"%s\" is not defined", XSTRING (arg)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1871 else if (EQ (result, Qt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1872 error ("the characters of the given font have varying widths");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1873 else if (STRINGP (result))
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 recompute_basic_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1876 store_frame_param (f, Qfont, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1877 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1878 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1879 abort ();
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1882 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1883 x_set_border_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1884 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1885 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1886 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1887 CHECK_NUMBER (arg, 0);
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 if (XINT (arg) == f->output_data.win32->border_width)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1890 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1891
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1892 if (FRAME_WIN32_WINDOW (f) != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1893 error ("Cannot change the border width of a window");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1894
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1895 f->output_data.win32->border_width = XINT (arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1896 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1897
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1898 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1899 x_set_internal_border_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1900 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1901 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1902 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1903 int mask;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1904 int old = f->output_data.win32->internal_border_width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1905
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1906 CHECK_NUMBER (arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1907 f->output_data.win32->internal_border_width = XINT (arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1908 if (f->output_data.win32->internal_border_width < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1909 f->output_data.win32->internal_border_width = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1910
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1911 if (f->output_data.win32->internal_border_width == old)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1912 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1913
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1914 if (FRAME_WIN32_WINDOW (f) != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1915 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1916 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1917 x_set_window_size (f, 0, f->width, f->height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1918 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1919 SET_FRAME_GARBAGED (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1920 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1921 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1922
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1923 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1924 x_set_visibility (f, value, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1925 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1926 Lisp_Object value, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1927 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1928 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1929 XSETFRAME (frame, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1930
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1931 if (NILP (value))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1932 Fmake_frame_invisible (frame, Qt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1933 else if (EQ (value, Qicon))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1934 Ficonify_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1935 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1936 Fmake_frame_visible (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1937 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1938
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1939 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1940 x_set_menu_bar_lines (f, value, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1941 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1942 Lisp_Object value, oldval;
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 int nlines;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1945 int olines = FRAME_MENU_BAR_LINES (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1946
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1947 /* Right now, menu bars don't work properly in minibuf-only frames;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1948 most of the commands try to apply themselves to the minibuffer
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1949 frame itslef, and get an error because you can't switch buffers
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1950 in or split the minibuffer window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1951 if (FRAME_MINIBUF_ONLY_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1952 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1953
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1954 if (INTEGERP (value))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1955 nlines = XINT (value);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1956 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1957 nlines = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1958
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1959 FRAME_MENU_BAR_LINES (f) = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1960 if (nlines)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1961 FRAME_EXTERNAL_MENU_BAR (f) = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1962 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1963 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1964 if (FRAME_EXTERNAL_MENU_BAR (f) == 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1965 free_frame_menubar (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1966 FRAME_EXTERNAL_MENU_BAR (f) = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1967 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1968 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1969
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1970 /* Change the name of frame F to NAME. If NAME is nil, set F's name to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1971 win32_id_name.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1972
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1973 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
1974 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
1975 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1976
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1977 If EXPLICIT is zero, that indicates that Emacs redisplay code is
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1978 suggesting a new name, which lisp code should override; if
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1979 F->explicit_name is set, ignore the new name; otherwise, set it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1980
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1981 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1982 x_set_name (f, name, explicit)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1983 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1984 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1985 int explicit;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1986 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1987 /* Make sure that requests from lisp code override requests from
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1988 Emacs redisplay code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1989 if (explicit)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1990 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1991 /* If we're switching from explicit to implicit, we had better
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1992 update the mode lines and thereby update the title. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1993 if (f->explicit_name && NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1994 update_mode_lines = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1995
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1996 f->explicit_name = ! NILP (name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1997 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1998 else if (f->explicit_name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1999 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2000
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2001 /* If NAME is nil, set the name to the win32_id_name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2002 if (NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2003 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2004 /* Check for no change needed in this very common case
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2005 before we do any consing. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2006 if (!strcmp (FRAME_WIN32_DISPLAY_INFO (f)->win32_id_name,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2007 XSTRING (f->name)->data))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2008 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2009 name = build_string (FRAME_WIN32_DISPLAY_INFO (f)->win32_id_name);
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 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2012 CHECK_STRING (name, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2013
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2014 /* Don't change the name if it's already NAME. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2015 if (! NILP (Fstring_equal (name, f->name)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2016 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2017
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2018 if (FRAME_WIN32_WINDOW (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2019 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2020 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2021 SetWindowText(FRAME_WIN32_WINDOW (f), XSTRING (name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2022 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2023 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2024
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2025 f->name = name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2026 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2027
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2028 /* This function should be called when the user's lisp code has
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2029 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
2030 redisplay code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2031 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2032 x_explicitly_set_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2033 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2034 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2035 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2036 x_set_name (f, arg, 1);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2039 /* This function should be called by Emacs redisplay code to set the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2040 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
2041 lisp code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2042 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2043 x_implicitly_set_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2044 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2045 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2046 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2047 x_set_name (f, arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2048 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2049
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2050 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2051 x_set_autoraise (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2052 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2053 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2054 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2055 f->auto_raise = !EQ (Qnil, arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2056 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2057
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2058 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2059 x_set_autolower (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2060 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2061 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2062 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2063 f->auto_lower = !EQ (Qnil, arg);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2066 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2067 x_set_unsplittable (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2068 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2069 Lisp_Object arg, oldval;
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 f->no_split = !NILP (arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2072 }
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 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2075 x_set_vertical_scroll_bars (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2076 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2077 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2078 {
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2079 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
2080 || (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
2081 || (NILP (arg) && FRAME_HAS_VERTICAL_SCROLL_BARS (f))
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2082 || (!NILP (arg) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f)))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2083 {
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2084 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = NILP (arg) ?
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2085 vertical_scroll_bar_none :
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2086 EQ (Qright, arg)
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2087 ? vertical_scroll_bar_right
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2088 : vertical_scroll_bar_left;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2089
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2090 /* We set this parameter before creating the window for the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2091 frame, so we can get the geometry right from the start.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2092 However, if the window hasn't been created yet, we shouldn't
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2093 call x_set_window_size. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2094 if (FRAME_WIN32_WINDOW (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2095 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
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 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2098
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2099 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2100 x_set_scroll_bar_width (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2101 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2102 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2103 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2104 if (NILP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2105 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2106 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2107 FRAME_SCROLL_BAR_COLS (f) = 2;
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 else if (INTEGERP (arg) && XINT (arg) > 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2110 && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2111 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2112 int wid = FONT_WIDTH (f->output_data.win32->font);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2113 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2114 FRAME_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + wid-1) / wid;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2115 if (FRAME_WIN32_WINDOW (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2116 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f));
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 }
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 /* Subroutines of creating an frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2121
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2122 /* Make sure that Vx_resource_name is set to a reasonable value.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2123 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
2124
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2125 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2126 validate_x_resource_name ()
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 int len;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2129 /* Number of valid characters in the resource name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2130 int good_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2131 /* Number of invalid characters in the resource name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2132 int bad_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2133 Lisp_Object new;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2134 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2135
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2136 if (STRINGP (Vx_resource_name))
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 unsigned char *p = XSTRING (Vx_resource_name)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2139 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2140
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2141 len = XSTRING (Vx_resource_name)->size;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2142
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2143 /* Only letters, digits, - and _ are valid in resource names.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2144 Count the valid characters and count the invalid ones. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2145 for (i = 0; i < len; i++)
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 int c = p[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2148 if (! ((c >= 'a' && c <= 'z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2149 || (c >= 'A' && c <= 'Z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2150 || (c >= '0' && c <= '9')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2151 || c == '-' || c == '_'))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2152 bad_count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2153 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2154 good_count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2155 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2156 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2157 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2158 /* Not a string => completely invalid. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2159 bad_count = 5, good_count = 0;
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 name is valid already, return. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2162 if (bad_count == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2163 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2164
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2165 /* If name is entirely invalid, or nearly so, use `emacs'. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2166 if (good_count == 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2167 || (good_count == 1 && bad_count > 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2168 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2169 Vx_resource_name = build_string ("emacs");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2170 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2171 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2172
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2173 /* Name is partly valid. Copy it and replace the invalid characters
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2174 with underscores. */
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 Vx_resource_name = new = Fcopy_sequence (Vx_resource_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2177
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2178 for (i = 0; i < len; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2179 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2180 int c = XSTRING (new)->data[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2181 if (! ((c >= 'a' && c <= 'z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2182 || (c >= 'A' && c <= 'Z')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2183 || (c >= '0' && c <= '9')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2184 || c == '-' || c == '_'))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2185 XSTRING (new)->data[i] = '_';
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2186 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2187 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2188
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2189
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2190 extern char *x_get_string_resource ();
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 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
2193 "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
2194 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
2195 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
2196 the name specified by the `-name' or `-rn' command-line arguments.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2197 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2198 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
2199 class, respectively. You must specify both of them or neither.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2200 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE'\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2201 and the class is `Emacs.CLASS.SUBCLASS'.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2202 (attribute, class, component, subclass)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2203 Lisp_Object attribute, class, component, subclass;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2204 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2205 register char *value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2206 char *name_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2207 char *class_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2208
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2209 CHECK_STRING (attribute, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2210 CHECK_STRING (class, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2211
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2212 if (!NILP (component))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2213 CHECK_STRING (component, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2214 if (!NILP (subclass))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2215 CHECK_STRING (subclass, 2);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2216 if (NILP (component) != NILP (subclass))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2217 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2218
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2219 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2220
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2221 /* Allocate space for the components, the dots which separate them,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2222 and the final '\0'. Make them big enough for the worst case. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2223 name_key = (char *) alloca (XSTRING (Vx_resource_name)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2224 + (STRINGP (component)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2225 ? XSTRING (component)->size : 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2226 + XSTRING (attribute)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2227 + 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2228
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2229 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2230 + XSTRING (class)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2231 + (STRINGP (subclass)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2232 ? XSTRING (subclass)->size : 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2233 + 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2234
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2235 /* Start with emacs.FRAMENAME for the name (the specific one)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2236 and with `Emacs' for the class key (the general one). */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2237 strcpy (name_key, XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2238 strcpy (class_key, EMACS_CLASS);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2239
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2240 strcat (class_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2241 strcat (class_key, XSTRING (class)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2242
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2243 if (!NILP (component))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2244 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2245 strcat (class_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2246 strcat (class_key, XSTRING (subclass)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2247
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2248 strcat (name_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2249 strcat (name_key, XSTRING (component)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2250 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2251
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2252 strcat (name_key, ".");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2253 strcat (name_key, XSTRING (attribute)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2254
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2255 value = x_get_string_resource (Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2256 name_key, class_key);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2257
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2258 if (value != (char *) 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2259 return build_string (value);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2260 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2261 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2262 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2263
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2264 /* Used when C code wants a resource value. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2265
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2266 char *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2267 x_get_resource_string (attribute, class)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2268 char *attribute, *class;
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 register char *value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2271 char *name_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2272 char *class_key;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2273
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2274 /* Allocate space for the components, the dots which separate them,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2275 and the final '\0'. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2276 name_key = (char *) alloca (XSTRING (Vinvocation_name)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2277 + strlen (attribute) + 2);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2278 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2279 + strlen (class) + 2);
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 sprintf (name_key, "%s.%s",
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2282 XSTRING (Vinvocation_name)->data,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2283 attribute);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2284 sprintf (class_key, "%s.%s", EMACS_CLASS, class);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2285
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2286 return x_get_string_resource (selected_frame,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2287 name_key, class_key);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2288 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2289
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2290 /* Types we might convert a resource string into. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2291 enum resource_types
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2292 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2293 number, boolean, string, symbol
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2294 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2295
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2296 /* Return the value of parameter PARAM.
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 First search ALIST, then Vdefault_frame_alist, then the X defaults
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2299 database, using ATTRIBUTE as the attribute name and CLASS as its class.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2300
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2301 Convert the resource to the type specified by desired_type.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2302
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2303 If no default is specified, return Qunbound. If you call
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2304 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
2305 and don't let it get stored in any Lisp-visible variables! */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2306
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2307 static Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2308 x_get_arg (alist, param, attribute, class, type)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2309 Lisp_Object alist, param;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2310 char *attribute;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2311 char *class;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2312 enum resource_types type;
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 register Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2315
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2316 tem = Fassq (param, alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2317 if (EQ (tem, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2318 tem = Fassq (param, Vdefault_frame_alist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2319 if (EQ (tem, Qnil))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2320 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2321
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2322 if (attribute)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2323 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2324 tem = Fx_get_resource (build_string (attribute),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2325 build_string (class),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2326 Qnil, Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2327
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2328 if (NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2329 return Qunbound;
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 switch (type)
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 case number:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2334 return make_number (atoi (XSTRING (tem)->data));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2335
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2336 case boolean:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2337 tem = Fdowncase (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2338 if (!strcmp (XSTRING (tem)->data, "on")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2339 || !strcmp (XSTRING (tem)->data, "true"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2340 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2341 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2342 return Qnil;
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 case string:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2345 return tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2346
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2347 case symbol:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2348 /* As a special case, we map the values `true' and `on'
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2349 to Qt, and `false' and `off' to Qnil. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2350 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2351 Lisp_Object lower;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2352 lower = Fdowncase (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2353 if (!strcmp (XSTRING (lower)->data, "on")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2354 || !strcmp (XSTRING (lower)->data, "true"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2355 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2356 else if (!strcmp (XSTRING (lower)->data, "off")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2357 || !strcmp (XSTRING (lower)->data, "false"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2358 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2359 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2360 return Fintern (tem, Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2361 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2362
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2363 default:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2364 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2365 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2366 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2367 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2368 return Qunbound;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2369 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2370 return Fcdr (tem);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2371 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2372
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2373 /* Record in frame F the specified or default value according to ALIST
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2374 of the parameter named PARAM (a Lisp symbol).
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2375 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
2376 on the frame named NAME.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2377 If that is not found either, use the value DEFLT. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2378
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2379 static Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2380 x_default_parameter (f, alist, prop, deflt, xprop, xclass, type)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2381 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2382 Lisp_Object alist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2383 Lisp_Object prop;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2384 Lisp_Object deflt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2385 char *xprop;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2386 char *xclass;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2387 enum resource_types type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2388 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2389 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2390
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2391 tem = x_get_arg (alist, prop, xprop, xclass, type);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2392 if (EQ (tem, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2393 tem = deflt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2394 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2395 return tem;
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 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
2399 "Parse an X-style geometry string STRING.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2400 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2401 The properties returned may include `top', `left', `height', and `width'.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2402 The value of `left' or `top' may be an integer,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2403 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
2404 or a list (- N) meaning -N pixels relative to bottom/right corner.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2405 (string)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2406 Lisp_Object string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2407 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2408 int geometry, x, y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2409 unsigned int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2410 Lisp_Object result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2411
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2412 CHECK_STRING (string, 0);
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 geometry = XParseGeometry ((char *) XSTRING (string)->data,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2415 &x, &y, &width, &height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2416
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2417 result = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2418 if (geometry & XValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2419 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2420 Lisp_Object element;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2421
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2422 if (x >= 0 && (geometry & XNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2423 element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2424 else if (x < 0 && ! (geometry & XNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2425 element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2426 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2427 element = Fcons (Qleft, make_number (x));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2428 result = Fcons (element, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2429 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2430
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2431 if (geometry & YValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2432 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2433 Lisp_Object element;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2435 if (y >= 0 && (geometry & YNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2436 element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2437 else if (y < 0 && ! (geometry & YNegative))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2438 element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2439 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2440 element = Fcons (Qtop, make_number (y));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2441 result = Fcons (element, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2442 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2443
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2444 if (geometry & WidthValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2445 result = Fcons (Fcons (Qwidth, make_number (width)), result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2446 if (geometry & HeightValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2447 result = Fcons (Fcons (Qheight, make_number (height)), result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2448
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2449 return result;
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2452 /* Calculate the desired size and position of this window,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2453 and return the flags saying which aspects were specified.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2454
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2455 This function does not make the coordinates positive. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2456
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2457 #define DEFAULT_ROWS 40
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2458 #define DEFAULT_COLS 80
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 static int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2461 x_figure_window_size (f, parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2462 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2463 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2464 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2465 register Lisp_Object tem0, tem1, tem2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2466 int height, width, left, top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2467 register int geometry;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2468 long window_prompting = 0;
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 /* Default values if we fall through.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2471 Actually, if that happens we should get
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2472 window manager prompting. */
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2473 SET_FRAME_WIDTH (f, DEFAULT_COLS);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2474 f->height = DEFAULT_ROWS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2475 /* Window managers expect that if program-specified
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2476 positions are not (0,0), they're intentional, not defaults. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2477 f->output_data.win32->top_pos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2478 f->output_data.win32->left_pos = 0;
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 tem0 = x_get_arg (parms, Qheight, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2481 tem1 = x_get_arg (parms, Qwidth, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2482 tem2 = x_get_arg (parms, Quser_size, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2483 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
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 if (!EQ (tem0, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2486 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2487 CHECK_NUMBER (tem0, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2488 f->height = XINT (tem0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2489 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2490 if (!EQ (tem1, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2491 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2492 CHECK_NUMBER (tem1, 0);
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
2493 SET_FRAME_WIDTH (f, XINT (tem1));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2494 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2495 if (!NILP (tem2) && !EQ (tem2, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2496 window_prompting |= USSize;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2497 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2498 window_prompting |= PSize;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2499 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2500
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2501 f->output_data.win32->vertical_scroll_bar_extra
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2502 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2503 ? 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2504 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2505 ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2506 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.win32->font)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2507 f->output_data.win32->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2508 f->output_data.win32->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2509
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2510 tem0 = x_get_arg (parms, Qtop, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2511 tem1 = x_get_arg (parms, Qleft, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2512 tem2 = x_get_arg (parms, Quser_position, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2513 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound))
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 if (EQ (tem0, Qminus))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2516 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2517 f->output_data.win32->top_pos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2518 window_prompting |= YNegative;
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 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2521 && CONSP (XCONS (tem0)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2522 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2523 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2524 f->output_data.win32->top_pos = - XINT (XCONS (XCONS (tem0)->cdr)->car);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2525 window_prompting |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2526 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2527 else if (CONSP (tem0) && EQ (XCONS (tem0)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2528 && CONSP (XCONS (tem0)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2529 && INTEGERP (XCONS (XCONS (tem0)->cdr)->car))
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 f->output_data.win32->top_pos = XINT (XCONS (XCONS (tem0)->cdr)->car);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2532 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2533 else if (EQ (tem0, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2534 f->output_data.win32->top_pos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2535 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2536 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2537 CHECK_NUMBER (tem0, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2538 f->output_data.win32->top_pos = XINT (tem0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2539 if (f->output_data.win32->top_pos < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2540 window_prompting |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2541 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2542
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2543 if (EQ (tem1, Qminus))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2544 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2545 f->output_data.win32->left_pos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2546 window_prompting |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2547 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2548 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qminus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2549 && CONSP (XCONS (tem1)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2550 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2551 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2552 f->output_data.win32->left_pos = - XINT (XCONS (XCONS (tem1)->cdr)->car);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2553 window_prompting |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2554 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2555 else if (CONSP (tem1) && EQ (XCONS (tem1)->car, Qplus)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2556 && CONSP (XCONS (tem1)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2557 && INTEGERP (XCONS (XCONS (tem1)->cdr)->car))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2558 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2559 f->output_data.win32->left_pos = XINT (XCONS (XCONS (tem1)->cdr)->car);
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 else if (EQ (tem1, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2562 f->output_data.win32->left_pos = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2563 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2564 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2565 CHECK_NUMBER (tem1, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2566 f->output_data.win32->left_pos = XINT (tem1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2567 if (f->output_data.win32->left_pos < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2568 window_prompting |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2569 }
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 if (!NILP (tem2) && ! EQ (tem2, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2572 window_prompting |= USPosition;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2573 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2574 window_prompting |= PPosition;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2575 }
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 return window_prompting;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2578 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2579
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2580
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 extern LRESULT CALLBACK win32_wnd_proc ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2583
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2584 BOOL
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2585 win32_init_class (hinst)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2586 HINSTANCE hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2587 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2588 WNDCLASS wc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2589
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2590 wc.style = CS_HREDRAW | CS_VREDRAW;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2591 wc.lpfnWndProc = (WNDPROC) win32_wnd_proc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2592 wc.cbClsExtra = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2593 wc.cbWndExtra = WND_EXTRA_BYTES;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2594 wc.hInstance = hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2595 wc.hIcon = LoadIcon (hinst, EMACS_CLASS);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2596 wc.hCursor = LoadCursor (NULL, IDC_ARROW);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2597 wc.hbrBackground = NULL; // GetStockObject (WHITE_BRUSH);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2598 wc.lpszMenuName = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2599 wc.lpszClassName = EMACS_CLASS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2600
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2601 return (RegisterClass (&wc));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2602 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2603
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2604 HWND
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2605 win32_createscrollbar (f, bar)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2606 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2607 struct scroll_bar * bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2608 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2609 return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2610 /* Position and size of scroll bar. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2611 XINT(bar->left), XINT(bar->top),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2612 XINT(bar->width), XINT(bar->height),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2613 FRAME_WIN32_WINDOW (f),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2614 NULL,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2615 hinst,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2616 NULL));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2617 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2618
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2619 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2620 win32_createwindow (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2621 struct frame *f;
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 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2624
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2625 /* Do first time app init */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2626
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2627 if (!hprevinst)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2628 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2629 win32_init_class (hinst);
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 FRAME_WIN32_WINDOW (f) = hwnd = CreateWindow (EMACS_CLASS,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2633 f->namebuf,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2634 f->output_data.win32->dwStyle | WS_CLIPCHILDREN,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2635 f->output_data.win32->left_pos,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2636 f->output_data.win32->top_pos,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2637 PIXEL_WIDTH (f),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2638 PIXEL_HEIGHT (f),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2639 NULL,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2640 NULL,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2641 hinst,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2642 NULL);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2643
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2644 if (hwnd)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2645 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2646 SetWindowLong (hwnd, WND_X_UNITS_INDEX, FONT_WIDTH (f->output_data.win32->font));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2647 SetWindowLong (hwnd, WND_Y_UNITS_INDEX, f->output_data.win32->line_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2648 SetWindowLong (hwnd, WND_BACKGROUND_INDEX, f->output_data.win32->background_pixel);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2649
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2650 /* 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
2651 ShowWindow (hwnd, SW_HIDE);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2652 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2653 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2654
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2655 /* Convert between the modifier bits Win32 uses and the modifier bits
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2656 Emacs uses. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2657 unsigned int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2658 win32_get_modifiers ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2659 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2660 return (((GetKeyState (VK_SHIFT)&0x8000) ? shift_modifier : 0) |
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2661 ((GetKeyState (VK_CONTROL)&0x8000) ? ctrl_modifier : 0) |
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
2662 ((GetKeyState (VK_MENU)&0x8000) ?
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
2663 ((NILP (Vwin32_alt_is_meta)) ? alt_modifier : meta_modifier) : 0));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2664 }
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 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2667 my_post_msg (wmsg, hwnd, msg, wParam, lParam)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2668 Win32Msg * wmsg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2669 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2670 UINT msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2671 WPARAM wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2672 LPARAM lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2673 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2674 wmsg->msg.hwnd = hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2675 wmsg->msg.message = msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2676 wmsg->msg.wParam = wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2677 wmsg->msg.lParam = lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2678 wmsg->msg.time = GetMessageTime ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2679
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2680 post_msg (wmsg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2681 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2682
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2683 /* GetKeyState and MapVirtualKey on Win95 do not actually distinguish
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2684 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
2685 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
2686 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
2687 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
2688 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
2689 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
2690 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
2691 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
2692 on Swedish keyboards). */
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2693
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2694 #define EMACS_LCONTROL 0
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2695 #define EMACS_RCONTROL 1
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2696 #define EMACS_LMENU 2
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2697 #define EMACS_RMENU 3
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2698
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2699 static int modifiers[4];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2700 static int modifiers_recorded;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2701 static int modifier_key_support_tested;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2702
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2703 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2704 test_modifier_support (unsigned int wparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2705 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2706 unsigned int l, r;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2707
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2708 if (wparam != VK_CONTROL && wparam != VK_MENU)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2709 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2710 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2711 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2712 l = VK_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2713 r = VK_RCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2714 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2715 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2716 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2717 l = VK_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2718 r = VK_RMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2719 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2720 if (!(GetKeyState (l) & 0x8000) && !(GetKeyState (r) & 0x8000))
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2721 modifiers_recorded = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2722 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2723 modifiers_recorded = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2724 modifier_key_support_tested = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2725 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2726
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2727 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2728 record_keydown (unsigned int wparam, unsigned int lparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2729 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2730 int i;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2731
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2732 if (!modifier_key_support_tested)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2733 test_modifier_support (wparam);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2734
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2735 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
2736 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2737
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2738 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2739 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2740 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2741 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2742
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2743 modifiers[i] = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2744 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2745
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2746 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2747 record_keyup (unsigned int wparam, unsigned int lparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2748 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2749 int i;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2750
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2751 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
2752 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2753
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2754 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2755 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2756 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2757 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2758
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2759 modifiers[i] = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2760 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2761
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2762 /* 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
2763 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
2764 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
2765 static void
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2766 reset_modifiers ()
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2767 {
15314
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2768 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
2769
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2770 if (!modifiers_recorded)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2771 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
2772
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2773 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
2774 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
2775
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2776 if (ctrl == 0 || alt == 0)
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2777 /* Emacs doesn't have keyboard focus. Do nothing. */
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2778 return;
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2779
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2780 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
2781 /* 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
2782 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
2783
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2784 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
2785 /* 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
2786 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
2787
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2788 /* Otherwise, leave the modifier state as it was when Emacs lost
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2789 keyboard focus. */
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2790 }
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2791
15377
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2792 /* 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
2793 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
2794 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
2795 the left or right modifier should be set. */
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2796 static void
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2797 sync_modifiers ()
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2798 {
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2799 if (!modifiers_recorded)
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2800 return;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2801
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2802 if (!(GetKeyState (VK_CONTROL) & 0x8000))
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2803 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2804
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2805 if (!(GetKeyState (VK_MENU) & 0x8000))
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2806 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2807 }
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2808
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2809 static int
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2810 modifier_set (int vkey)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2811 {
15280
f39684fddaff (modifier_set): Check toggle state of CapsLock even
Karl Heuer <kwzh@gnu.org>
parents: 15232
diff changeset
2812 if (vkey == VK_CAPITAL)
f39684fddaff (modifier_set): Check toggle state of CapsLock even
Karl Heuer <kwzh@gnu.org>
parents: 15232
diff changeset
2813 return (GetKeyState (vkey) & 0x1);
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2814 if (!modifiers_recorded)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2815 return (GetKeyState (vkey) & 0x8000);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2816
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2817 switch (vkey)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2818 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2819 case VK_LCONTROL:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2820 return modifiers[EMACS_LCONTROL];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2821 case VK_RCONTROL:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2822 return modifiers[EMACS_RCONTROL];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2823 case VK_LMENU:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2824 return modifiers[EMACS_LMENU];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2825 case VK_RMENU:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2826 return modifiers[EMACS_RMENU];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2827 default:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2828 break;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2829 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2830 return (GetKeyState (vkey) & 0x8000);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2831 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2832
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2833 /* 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
2834 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
2835 and window input. */
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2836
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2837 static int
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2838 construct_modifiers (unsigned int wparam, unsigned int lparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2839 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2840 int mods;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2841
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2842 if (wparam != VK_CONTROL && wparam != VK_MENU)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2843 mods = GetLastError ();
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2844
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2845 mods = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2846 mods |= (modifier_set (VK_SHIFT)) ? SHIFT_PRESSED : 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2847 mods |= (modifier_set (VK_CAPITAL)) ? CAPSLOCK_ON : 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2848 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
2849 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
2850 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
2851 mods |= (modifier_set (VK_RMENU)) ? RIGHT_ALT_PRESSED : 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2852
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2853 return mods;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2854 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2855
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2856 static unsigned int
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2857 map_keypad_keys (unsigned int wparam, unsigned int lparam)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2858 {
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2859 unsigned int extended = (lparam & 0x1000000L);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2860
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2861 if (wparam < VK_CLEAR || wparam > VK_DELETE)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2862 return wparam;
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2863
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2864 if (wparam == VK_RETURN)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2865 return (extended ? VK_NUMPAD_ENTER : VK_RETURN);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2866
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2867 if (wparam >= VK_PRIOR && wparam <= VK_DOWN)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2868 return (!extended ? (VK_NUMPAD_PRIOR + (wparam - VK_PRIOR)) : wparam);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2869
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2870 if (wparam == VK_INSERT || wparam == VK_DELETE)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2871 return (!extended ? (VK_NUMPAD_INSERT + (wparam - VK_INSERT)) : wparam);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2872
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2873 if (wparam == VK_CLEAR)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2874 return (!extended ? VK_NUMPAD_CLEAR : wparam);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2875
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2876 return wparam;
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2877 }
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2878
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2879 /* Main message dispatch loop. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2880
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2881 DWORD
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2882 win_msg_worker (dw)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2883 DWORD dw;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2884 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2885 MSG msg;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2886
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2887 /* Ensure our message queue is created */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2888
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2889 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2890
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2891 PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2892
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2893 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
2894 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2895 if (msg.hwnd == NULL)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2896 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2897 switch (msg.message)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2898 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2899 case WM_EMACS_CREATEWINDOW:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2900 win32_createwindow ((struct frame *) msg.wParam);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2901 PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2902 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2903 case WM_EMACS_CREATESCROLLBAR:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2904 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2905 HWND hwnd = win32_createscrollbar ((struct frame *) msg.wParam,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2906 (struct scroll_bar *) msg.lParam);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2907 PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, (WPARAM)hwnd, 0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2908 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2909 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2910 case WM_EMACS_KILL:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2911 return (0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2912 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2913 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2914 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2915 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2916 DispatchMessage (&msg);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2917 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2918 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2919
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2920 return (0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2921 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2922
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2923 /* Main window procedure */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2924
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2925 extern char *lispy_function_keys[];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2926
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2927 LRESULT CALLBACK
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2928 win32_wnd_proc (hwnd, msg, wParam, lParam)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2929 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2930 UINT msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2931 WPARAM wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2932 LPARAM lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2933 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2934 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2935 LRESULT ret = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2936 struct win32_display_info *dpyinfo = &one_win32_display_info;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2937 Win32Msg wmsg;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
2938 int windows_translate;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
2939
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2940 /* 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
2941 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
2942 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
2943 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
2944 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
2945
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2946 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
2947 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
2948 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
2949 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
2950 delete-frame has synchronized with this thread.
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2951
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2952 It is also safe to use functions that make GDI calls, such as
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2953 win32_clear_rect, because these functions must obtain a DC handle
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2954 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
2955
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2956 switch (msg)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2957 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2958 case WM_ERASEBKGND:
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2959 f = x_window_to_frame (dpyinfo, hwnd);
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2960 if (f)
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2961 {
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2962 GetUpdateRect (hwnd, &wmsg.rect, FALSE);
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2963 win32_clear_rect (f, NULL, &wmsg.rect);
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2964 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2965 return 1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2966 case WM_PALETTECHANGED:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2967 /* ignore our own changes */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2968 if ((HWND)wParam != hwnd)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2969 {
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2970 f = x_window_to_frame (dpyinfo, hwnd);
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2971 if (f)
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2972 /* 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
2973 frames to be redrawn if needed. */
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2974 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
2975 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2976 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2977 case WM_PAINT:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2978 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2979 PAINTSTRUCT paintStruct;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2980
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2981 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2982 BeginPaint (hwnd, &paintStruct);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2983 wmsg.rect = paintStruct.rcPaint;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2984 EndPaint (hwnd, &paintStruct);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2985 leave_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2986
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2987 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2988
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2989 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2990 }
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2991
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2992 case WM_KEYUP:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2993 case WM_SYSKEYUP:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2994 record_keyup (wParam, lParam);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2995 goto dflt;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2996
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2997 case WM_KEYDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2998 case WM_SYSKEYDOWN:
15377
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2999 /* Synchronize modifiers with current keystroke. */
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3000 sync_modifiers ();
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
3001
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3002 record_keydown (wParam, lParam);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3003
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3004 wParam = map_keypad_keys (wParam, lParam);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3005
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3006 windows_translate = 0;
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3007 switch (wParam) {
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3008 case VK_LWIN:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3009 case VK_RWIN:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3010 case VK_APPS:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3011 /* More support for these keys will likely be necessary. */
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3012 if (!NILP (Vwin32_pass_optional_keys_to_system))
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3013 windows_translate = 1;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3014 break;
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3015 case VK_MENU:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3016 if (NILP (Vwin32_pass_alt_to_system))
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3017 return 0;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3018 windows_translate = 1;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3019 break;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3020 case VK_CONTROL:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3021 case VK_CAPITAL:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3022 case VK_SHIFT:
15314
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3023 case VK_NUMLOCK:
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3024 case VK_SCROLL:
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3025 windows_translate = 1;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3026 break;
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3027 default:
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3028 /* If not defined as a function key, change it to a WM_CHAR message. */
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3029 if (lispy_function_keys[wParam] == 0)
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3030 msg = WM_CHAR;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3031 break;
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3032 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3033
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3034 if (windows_translate)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3035 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3036 MSG winmsg = { hwnd, msg, wParam, lParam, 0, {0,0} };
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3037
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3038 winmsg.time = GetMessageTime ();
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3039 TranslateMessage (&winmsg);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3040 goto dflt;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3041 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3042
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3043 /* Fall through */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3044
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3045 case WM_SYSCHAR:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3046 case WM_CHAR:
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3047 wmsg.dwModifiers = construct_modifiers (wParam, lParam);
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3048
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3049 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3050 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
3051
15232
4c4924843e34 (win32_wnd_proc): Reenable quit_char detection.
Richard M. Stallman <rms@gnu.org>
parents: 15206
diff changeset
3052 #if 1
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3053 /* Detect quit_char and set quit-flag directly. Note that we dow
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3054 this *after* posting the message to ensure the main thread will
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3055 be woken up if blocked in sys_select(). */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3056 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3057 int c = wParam;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3058 if (isalpha (c) && (wmsg.dwModifiers == LEFT_CTRL_PRESSED
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3059 || wmsg.dwModifiers == RIGHT_CTRL_PRESSED))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3060 c = make_ctrl_char (c) & 0377;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3061 if (c == quit_char)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3062 Vquit_flag = Qt;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3063 }
15206
16d0e8c36378 (win32_wnd_proc): Disable setting of Vquit_flag
Geoff Voelker <voelker@cs.washington.edu>
parents: 15205
diff changeset
3064 #endif
16d0e8c36378 (win32_wnd_proc): Disable setting of Vquit_flag
Geoff Voelker <voelker@cs.washington.edu>
parents: 15205
diff changeset
3065
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3066 leave_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3067 break;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3068
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3069 /* 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
3070 are used together, but only if user has two button mouse. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3071 case WM_LBUTTONDOWN:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3072 case WM_RBUTTONDOWN:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3073 if (XINT (Vwin32_num_mouse_buttons) == 3)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3074 goto handle_plain_button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3075
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3076 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3077 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
3078 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
3079
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3080 if (button_state & this)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3081 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3082
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3083 if (button_state == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3084 SetCapture (hwnd);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3085
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3086 button_state |= this;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3087
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3088 if (button_state & other)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3089 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3090 if (mouse_button_timer)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3091 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3092 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3093 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3094
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3095 /* Generate middle mouse event instead. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3096 msg = WM_MBUTTONDOWN;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3097 button_state |= MMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3098 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3099 else if (button_state & MMOUSE)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3100 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3101 /* 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
3102 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
3103 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
3104 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
3105 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3106 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3107 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3108 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3109 /* Flush out saved message. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3110 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
3111 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3112 wmsg.dwModifiers = win32_get_modifiers ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3113 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
3114
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3115 /* Clear message buffer. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3116 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
3117 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3118 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3119 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3120 /* Hold onto message for now. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3121 mouse_button_timer =
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3122 SetTimer (hwnd, MOUSE_BUTTON_ID, XINT (Vwin32_mouse_button_tolerance), NULL);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3123 saved_mouse_button_msg.msg.hwnd = hwnd;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3124 saved_mouse_button_msg.msg.message = msg;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3125 saved_mouse_button_msg.msg.wParam = wParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3126 saved_mouse_button_msg.msg.lParam = lParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3127 saved_mouse_button_msg.msg.time = GetMessageTime ();
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3128 saved_mouse_button_msg.dwModifiers = win32_get_modifiers ();
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3129 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3130 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3131 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3132
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3133 case WM_LBUTTONUP:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3134 case WM_RBUTTONUP:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3135 if (XINT (Vwin32_num_mouse_buttons) == 3)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3136 goto handle_plain_button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3137
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3138 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3139 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
3140 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
3141
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3142 if ((button_state & this) == 0)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3143 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3144
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3145 button_state &= ~this;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3146
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3147 if (button_state & MMOUSE)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3148 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3149 /* 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
3150 if ((button_state & other) == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3151 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3152 msg = WM_MBUTTONUP;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3153 button_state &= ~MMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3154
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3155 if (button_state) abort ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3156 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3157 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3158 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3159 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3160 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3161 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3162 /* Flush out saved message if necessary. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3163 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
3164 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3165 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
3166 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3167 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3168 wmsg.dwModifiers = win32_get_modifiers ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3169 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
3170
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3171 /* 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
3172 saved_mouse_button_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3173 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3174 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3175
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3176 if (button_state == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3177 ReleaseCapture ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3178 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3179 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3180
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3181 case WM_MBUTTONDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3182 case WM_MBUTTONUP:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3183 handle_plain_button:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3184 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3185 BOOL up;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3186
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3187 if (parse_button (msg, NULL, &up))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3188 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3189 if (up) ReleaseCapture ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3190 else SetCapture (hwnd);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3191 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3192 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3193
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3194 wmsg.dwModifiers = win32_get_modifiers ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3195 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
3196 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3197
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3198 case WM_VSCROLL:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3199 case WM_MOUSEMOVE:
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3200 if (XINT (Vwin32_mouse_move_interval) <= 0
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3201 || (msg == WM_MOUSEMOVE && button_state == 0))
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3202 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3203 wmsg.dwModifiers = win32_get_modifiers ();
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3204 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
3205 return 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3206 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3207
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3208 /* 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
3209 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
3210 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
3211 expires, we just replace the first message. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3212
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3213 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
3214 mouse_move_timer =
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3215 SetTimer (hwnd, MOUSE_MOVE_ID, XINT (Vwin32_mouse_move_interval), NULL);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3216
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3217 /* Hold onto message for now. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3218 saved_mouse_move_msg.msg.hwnd = hwnd;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3219 saved_mouse_move_msg.msg.message = msg;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3220 saved_mouse_move_msg.msg.wParam = wParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3221 saved_mouse_move_msg.msg.lParam = lParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3222 saved_mouse_move_msg.msg.time = GetMessageTime ();
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3223 saved_mouse_move_msg.dwModifiers = win32_get_modifiers ();
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3224
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3225 return 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3226
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3227 case WM_TIMER:
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3228 /* Flush out saved messages if necessary. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3229 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
3230 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3231 if (saved_mouse_button_msg.msg.hwnd)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3232 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3233 post_msg (&saved_mouse_button_msg);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3234 saved_mouse_button_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3235 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3236 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3237 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3238 }
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3239 else if (wParam == mouse_move_timer)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3240 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3241 if (saved_mouse_move_msg.msg.hwnd)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3242 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3243 post_msg (&saved_mouse_move_msg);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3244 saved_mouse_move_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3245 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3246 KillTimer (hwnd, mouse_move_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3247 mouse_move_timer = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3248 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3249 return 0;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3250
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3251 case WM_NCACTIVATE:
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3252 /* Windows doesn't send us focus messages when putting up and
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3253 taking down a system popup dialog as for Ctrl-Alt-Del on Win95.
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3254 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
3255 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
3256 keyboard modifiers' state. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3257 reset_modifiers ();
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3258 goto dflt;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3259
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3260 case WM_SETFOCUS:
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3261 reset_modifiers ();
15314
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
3262 case WM_KILLFOCUS:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3263 case WM_MOVE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3264 case WM_SIZE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3265 case WM_SYSCOMMAND:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3266 case WM_COMMAND:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3267 wmsg.dwModifiers = win32_get_modifiers ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3268 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3269 goto dflt;
15034
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
3270
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
3271 case WM_CLOSE:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3272 wmsg.dwModifiers = win32_get_modifiers ();
15034
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
3273 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
3274 return 0;
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
3275
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3276 case WM_WINDOWPOSCHANGING:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3277 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3278 WINDOWPLACEMENT wp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3279 LPWINDOWPOS lppos = (WINDOWPOS *) lParam;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3280
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3281 GetWindowPlacement (hwnd, &wp);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3282
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3283 if (wp.showCmd != SW_SHOWMINIMIZED && ! (lppos->flags & SWP_NOSIZE))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3284 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3285 RECT rect;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3286 int wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3287 int hdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3288 DWORD dwXUnits;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3289 DWORD dwYUnits;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3290 RECT wr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3291
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3292 wp.length = sizeof(wp);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3293 GetWindowRect (hwnd, &wr);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3294
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3295 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3296
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3297 dwXUnits = GetWindowLong (hwnd, WND_X_UNITS_INDEX);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3298 dwYUnits = GetWindowLong (hwnd, WND_Y_UNITS_INDEX);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3299
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3300 leave_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3301
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3302 memset (&rect, 0, sizeof (rect));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3303 AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3304 GetMenu (hwnd) != NULL);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3305
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3306 /* All windows have an extra pixel so subtract 1 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3307
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3308 wdiff = (lppos->cx - (rect.right - rect.left) - 0) % dwXUnits;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3309 hdiff = (lppos->cy - (rect.bottom - rect.top) - 0) % dwYUnits;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3310
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3311 if (wdiff || hdiff)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3312 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3313 /* For right/bottom sizing we can just fix the sizes.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3314 However for top/left sizing we will need to fix the X
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3315 and Y positions as well. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3316
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3317 lppos->cx -= wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3318 lppos->cy -= hdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3319
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3320 if (wp.showCmd != SW_SHOWMAXIMIZED
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3321 && ! (lppos->flags & SWP_NOMOVE))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3322 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3323 if (lppos->x != wr.left || lppos->y != wr.top)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3324 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3325 lppos->x += wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3326 lppos->y += hdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3327 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3328 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3329 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3330 lppos->flags |= SWP_NOMOVE;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3331 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3332 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3333
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3334 ret = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3335 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3336 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3337 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3338
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3339 if (ret == 0) return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3340
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3341 goto dflt;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3342 case WM_EMACS_SHOWWINDOW:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3343 return ShowWindow (hwnd, wParam);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3344 case WM_EMACS_SETWINDOWPOS:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3345 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3346 Win32WindowPos * pos = (Win32WindowPos *) wParam;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3347 return SetWindowPos (hwnd, pos->hwndAfter,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3348 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
3349 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3350 case WM_EMACS_DESTROYWINDOW:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3351 DestroyWindow ((HWND) wParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3352 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3353 default:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3354 dflt:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3355 return DefWindowProc (hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3356 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3357
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3358 return (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3359 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3360
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3361 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3362 my_create_window (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3363 struct frame * f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3364 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3365 MSG msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3366
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3367 PostThreadMessage (dwWinThreadId, WM_EMACS_CREATEWINDOW, (WPARAM)f, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3368 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3369 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3370
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3371 /* Create and set up the win32 window for frame F. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3372
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3373 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3374 win32_window (f, window_prompting, minibuffer_only)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3375 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3376 long window_prompting;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3377 int minibuffer_only;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3378 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3379 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3380
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3381 /* Use the resource name as the top-level window name
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3382 for looking up resources. Make a non-Lisp copy
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3383 for the window manager, so GC relocation won't bother it.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3384
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3385 Elsewhere we specify the window name for the window manager. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3386
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3387 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3388 char *str = (char *) XSTRING (Vx_resource_name)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3389 f->namebuf = (char *) xmalloc (strlen (str) + 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3390 strcpy (f->namebuf, str);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3391 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3392
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3393 my_create_window (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3394
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3395 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3396
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3397 /* x_set_name normally ignores requests to set the name if the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3398 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
3399 place where that assumption isn't correct; f->name is set, but
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3400 the server hasn't been told. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3401 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3402 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3403 int explicit = f->explicit_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3404
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3405 f->explicit_name = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3406 name = f->name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3407 f->name = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3408 x_set_name (f, name, explicit);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3409 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3410
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3411 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3412
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3413 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3414 initialize_frame_menubar (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3415
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3416 if (FRAME_WIN32_WINDOW (f) == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3417 error ("Unable to create window");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3418 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3419
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3420 /* Handle the icon stuff for this window. Perhaps later we might
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3421 want an x_set_icon_position which can be called interactively as
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3422 well. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3423
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3424 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3425 x_icon (f, parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3426 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3427 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3428 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3429 Lisp_Object icon_x, icon_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3430
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3431 /* Set the position of the icon. Note that win95 groups all
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3432 icons in the tray. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3433 icon_x = x_get_arg (parms, Qicon_left, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3434 icon_y = x_get_arg (parms, Qicon_top, 0, 0, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3435 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3436 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3437 CHECK_NUMBER (icon_x, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3438 CHECK_NUMBER (icon_y, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3439 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3440 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3441 error ("Both left and top icon corners of icon must be specified");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3442
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3443 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3444
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3445 if (! EQ (icon_x, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3446 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3447
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3448 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3449 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3450
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3451 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3452 1, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3453 "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
3454 Returns an Emacs frame object.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3455 ALIST is an alist of frame parameters.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3456 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
3457 and do not specify a specific minibuffer window to use,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3458 then `default-minibuffer-frame' must be a frame whose minibuffer can\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3459 be shared by the new frame.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3460 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3461 This function is an internal primitive--use `make-frame' instead.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3462 (parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3463 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3464 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3465 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3466 Lisp_Object frame, tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3467 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3468 int minibuffer_only = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3469 long window_prompting = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3470 int width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3471 int count = specpdl_ptr - specpdl;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3472 struct gcpro gcpro1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3473 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3474 struct win32_display_info *dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3475 Lisp_Object parent;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3476 struct kboard *kb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3477
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3478 /* Use this general default value to start with
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3479 until we know if this frame has a specified name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3480 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3481
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3482 display = x_get_arg (parms, Qdisplay, 0, 0, string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3483 if (EQ (display, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3484 display = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3485 dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3486 #ifdef MULTI_KBOARD
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3487 kb = dpyinfo->kboard;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3488 #else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3489 kb = &the_only_kboard;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3490 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3491
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3492 name = x_get_arg (parms, Qname, "title", "Title", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3493 if (!STRINGP (name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3494 && ! EQ (name, Qunbound)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3495 && ! NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3496 error ("Invalid frame name--not a string or nil");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3497
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3498 if (STRINGP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3499 Vx_resource_name = name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3500
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3501 /* See if parent window is specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3502 parent = x_get_arg (parms, Qparent_id, NULL, NULL, number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3503 if (EQ (parent, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3504 parent = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3505 if (! NILP (parent))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3506 CHECK_NUMBER (parent, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3507
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3508 tem = x_get_arg (parms, Qminibuffer, 0, 0, symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3509 if (EQ (tem, Qnone) || NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3510 f = make_frame_without_minibuffer (Qnil, kb, display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3511 else if (EQ (tem, Qonly))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3512 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3513 f = make_minibuffer_frame ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3514 minibuffer_only = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3515 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3516 else if (WINDOWP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3517 f = make_frame_without_minibuffer (tem, kb, display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3518 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3519 f = make_frame (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3520
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3521 /* Note that Windows does support scroll bars. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3522 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
3523 /* 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
3524 f->scroll_bar_pixel_width = GetSystemMetrics (SM_CXVSCROLL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3525
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3526 XSETFRAME (frame, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3527 GCPRO1 (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3528
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3529 f->output_method = output_win32;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3530 f->output_data.win32 = (struct win32_output *) xmalloc (sizeof (struct win32_output));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3531 bzero (f->output_data.win32, sizeof (struct win32_output));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3532
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3533 /* FRAME_WIN32_DISPLAY_INFO (f) = dpyinfo; */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3534 #ifdef MULTI_KBOARD
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3535 FRAME_KBOARD (f) = kb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3536 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3537
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3538 /* Specify the parent under which to make this window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3539
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3540 if (!NILP (parent))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3541 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3542 f->output_data.win32->parent_desc = (Window) parent;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3543 f->output_data.win32->explicit_parent = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3544 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3545 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3546 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3547 f->output_data.win32->parent_desc = FRAME_WIN32_DISPLAY_INFO (f)->root_window;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3548 f->output_data.win32->explicit_parent = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3549 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3550
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3551 /* Note that the frame has no physical cursor right now. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3552 f->phys_cursor_x = -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3553
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3554 /* 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
3555 be set. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3556 if (EQ (name, Qunbound) || NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3557 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3558 f->name = build_string (dpyinfo->win32_id_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3559 f->explicit_name = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3560 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3561 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3562 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3563 f->name = name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3564 f->explicit_name = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3565 /* use the frame's title when getting resources for this frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3566 specbind (Qx_resource_name, name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3567 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3568
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3569 /* Extract the window parameters from the supplied values
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3570 that are needed to determine window geometry. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3571 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3572 Lisp_Object font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3573
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3574 font = x_get_arg (parms, Qfont, "font", "Font", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3575 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3576 /* First, try whatever font the caller has specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3577 if (STRINGP (font))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3578 font = x_new_font (f, XSTRING (font)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3579 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3580 /* Try out a font which we hope has bold and italic variations. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3581 if (!STRINGP (font))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3582 font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3583 if (! STRINGP (font))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3584 font = x_new_font (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3585 if (! STRINGP (font))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3586 /* This was formerly the first thing tried, but it finds too many fonts
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3587 and takes too long. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3588 font = x_new_font (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3589 /* 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
3590 if (! STRINGP (font))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3591 font = x_new_font (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3592 if (! STRINGP (font))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3593 font = x_new_font (f, "-*-system-medium-r-normal-*-*-200-*-*-c-120-*-*");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3594 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3595 if (! STRINGP (font))
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3596 font = x_new_font (f, "-*-Fixedsys-*-r-*-*-12-90-*-*-c-*-*-*");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3597 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3598 if (! STRINGP (font))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3599 font = build_string ("-*-system");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3600
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3601 x_default_parameter (f, parms, Qfont, font,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3602 "font", "Font", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3603 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3604
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3605 x_default_parameter (f, parms, Qborder_width, make_number (2),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3606 "borderwidth", "BorderWidth", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3607 /* This defaults to 2 in order to match xterm. We recognize either
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3608 internalBorderWidth or internalBorder (which is what xterm calls
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3609 it). */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3610 if (NILP (Fassq (Qinternal_border_width, parms)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3611 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3612 Lisp_Object value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3613
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3614 value = x_get_arg (parms, Qinternal_border_width,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3615 "internalBorder", "BorderWidth", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3616 if (! EQ (value, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3617 parms = Fcons (Fcons (Qinternal_border_width, value),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3618 parms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3619 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3620 x_default_parameter (f, parms, Qinternal_border_width, make_number (0),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3621 "internalBorderWidth", "BorderWidth", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3622 x_default_parameter (f, parms, Qvertical_scroll_bars, Qt,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3623 "verticalScrollBars", "ScrollBars", boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3624
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3625 /* Also do the stuff which must be set before the window exists. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3626 x_default_parameter (f, parms, Qforeground_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3627 "foreground", "Foreground", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3628 x_default_parameter (f, parms, Qbackground_color, build_string ("white"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3629 "background", "Background", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3630 x_default_parameter (f, parms, Qmouse_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3631 "pointerColor", "Foreground", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3632 x_default_parameter (f, parms, Qcursor_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3633 "cursorColor", "Foreground", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3634 x_default_parameter (f, parms, Qborder_color, build_string ("black"),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3635 "borderColor", "BorderColor", string);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3636
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3637 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3638 "menuBar", "MenuBar", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3639 x_default_parameter (f, parms, Qscroll_bar_width, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3640 "scrollBarWidth", "ScrollBarWidth", number);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3641
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3642 f->output_data.win32->dwStyle = WS_OVERLAPPEDWINDOW;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3643 f->output_data.win32->parent_desc = FRAME_WIN32_DISPLAY_INFO (f)->root_window;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3644 window_prompting = x_figure_window_size (f, parms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3645
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3646 if (window_prompting & XNegative)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3647 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3648 if (window_prompting & YNegative)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3649 f->output_data.win32->win_gravity = SouthEastGravity;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3650 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3651 f->output_data.win32->win_gravity = NorthEastGravity;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3652 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3653 else
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 if (window_prompting & YNegative)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3656 f->output_data.win32->win_gravity = SouthWestGravity;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3657 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3658 f->output_data.win32->win_gravity = NorthWestGravity;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3659 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3660
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3661 f->output_data.win32->size_hint_flags = window_prompting;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3662
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3663 win32_window (f, window_prompting, minibuffer_only);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3664 x_icon (f, parms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3665 init_frame_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3666
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3667 /* We need to do this after creating the window, so that the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3668 icon-creation functions can say whose icon they're describing. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3669 x_default_parameter (f, parms, Qicon_type, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3670 "bitmapIcon", "BitmapIcon", symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3671
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3672 x_default_parameter (f, parms, Qauto_raise, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3673 "autoRaise", "AutoRaiseLower", boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3674 x_default_parameter (f, parms, Qauto_lower, Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3675 "autoLower", "AutoRaiseLower", boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3676 x_default_parameter (f, parms, Qcursor_type, Qbox,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3677 "cursorType", "CursorType", symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3678
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3679 /* Dimensions, especially f->height, must be done via change_frame_size.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3680 Change will not be effected unless different from the current
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3681 f->height. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3682 width = f->width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3683 height = f->height;
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
3684 f->height = 0;
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
3685 SET_FRAME_WIDTH (f, 0);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3686 change_frame_size (f, height, width, 1, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3687
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3688 /* Tell the server what size and position, etc, we want,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3689 and how badly we want them. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3690 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3691 x_wm_set_size_hint (f, window_prompting, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3692 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3693
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3694 tem = x_get_arg (parms, Qunsplittable, 0, 0, boolean);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3695 f->no_split = minibuffer_only || EQ (tem, Qt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3696
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3697 UNGCPRO;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3698
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3699 /* It is now ok to make the frame official
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3700 even if we get an error below.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3701 And the frame needs to be on Vframe_list
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3702 or making it visible won't work. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3703 Vframe_list = Fcons (frame, Vframe_list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3704
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3705 /* Now that the frame is official, it counts as a reference to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3706 its display. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3707 FRAME_WIN32_DISPLAY_INFO (f)->reference_count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3708
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3709 /* Make the window appear on the frame and enable display,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3710 unless the caller says not to. However, with explicit parent,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3711 Emacs cannot control visibility, so don't try. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3712 if (! f->output_data.win32->explicit_parent)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3713 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3714 Lisp_Object visibility;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3715
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3716 visibility = x_get_arg (parms, Qvisibility, 0, 0, symbol);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3717 if (EQ (visibility, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3718 visibility = Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3719
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3720 if (EQ (visibility, Qicon))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3721 x_iconify_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3722 else if (! NILP (visibility))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3723 x_make_frame_visible (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3724 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3725 /* Must have been Qnil. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3726 ;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3727 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3728
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3729 return unbind_to (count, frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3730 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3731
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3732 /* 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
3733 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
3734 know about that structure. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3735 Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3736 x_get_focus_frame (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3737 struct frame *frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3738 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3739 struct win32_display_info *dpyinfo = FRAME_WIN32_DISPLAY_INFO (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3740 Lisp_Object xfocus;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3741 if (! dpyinfo->win32_focus_frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3742 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3743
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3744 XSETFRAME (xfocus, dpyinfo->win32_focus_frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3745 return xfocus;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3746 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3747
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3748 XFontStruct *
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3749 win32_load_font (dpyinfo,name)
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3750 struct win32_display_info *dpyinfo;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3751 char * name;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3752 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3753 XFontStruct * font = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3754 BOOL ok;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3755
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3756 {
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3757 LOGFONT lf;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3758
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3759 if (!name || !x_to_win32_font (name, &lf))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3760 return (NULL);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3761
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3762 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
3763
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3764 if (!font) return (NULL);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3765
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3766 BLOCK_INPUT;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3767
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3768 font->hfont = CreateFontIndirect (&lf);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3769 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3770
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3771 if (font->hfont == NULL)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3772 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3773 ok = FALSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3774 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3775 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3776 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3777 HDC hdc;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3778 HANDLE oldobj;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3779
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3780 hdc = GetDC (dpyinfo->root_window);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3781 oldobj = SelectObject (hdc, font->hfont);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3782 ok = GetTextMetrics (hdc, &font->tm);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3783 SelectObject (hdc, oldobj);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3784 ReleaseDC (dpyinfo->root_window, hdc);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3785 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3786
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3787 UNBLOCK_INPUT;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3788
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3789 if (ok) return (font);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3790
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3791 win32_unload_font (dpyinfo, font);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3792 return (NULL);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3793 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3794
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3795 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3796 win32_unload_font (dpyinfo, font)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3797 struct win32_display_info *dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3798 XFontStruct * font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3799 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3800 if (font)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3801 {
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3802 if (font->hfont) DeleteObject(font->hfont);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3803 xfree (font);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3804 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3805 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3806
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3807 /* The font conversion stuff between x and win32 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3808
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3809 /* X font string is as follows (from faces.el)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3810 * (let ((- "[-?]")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3811 * (foundry "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3812 * (family "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3813 * (weight "\\(bold\\|demibold\\|medium\\)") ; 1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3814 * (weight\? "\\([^-]*\\)") ; 1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3815 * (slant "\\([ior]\\)") ; 2
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3816 * (slant\? "\\([^-]?\\)") ; 2
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3817 * (swidth "\\([^-]*\\)") ; 3
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3818 * (adstyle "[^-]*") ; 4
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3819 * (pixelsize "[0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3820 * (pointsize "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3821 * (resx "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3822 * (resy "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3823 * (spacing "[cmp?*]")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3824 * (avgwidth "[0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3825 * (registry "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3826 * (encoding "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3827 * )
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3828 * (setq x-font-regexp
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3829 * (concat "\\`\\*?[-?*]"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3830 * foundry - family - weight\? - slant\? - swidth - adstyle -
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3831 * pixelsize - pointsize - resx - resy - spacing - registry -
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3832 * encoding "[-?*]\\*?\\'"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3833 * ))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3834 * (setq x-font-regexp-head
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3835 * (concat "\\`[-?*]" foundry - family - weight\? - slant\?
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3836 * "\\([-*?]\\|\\'\\)"))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3837 * (setq x-font-regexp-slant (concat - slant -))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3838 * (setq x-font-regexp-weight (concat - weight -))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3839 * nil)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3840 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3841
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3842 #define FONT_START "[-?]"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3843 #define FONT_FOUNDRY "[^-]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3844 #define FONT_FAMILY "\\([^-]+\\)" /* 1 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3845 #define FONT_WEIGHT "\\(bold\\|demibold\\|medium\\)" /* 2 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3846 #define FONT_WEIGHT_Q "\\([^-]*\\)" /* 2 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3847 #define FONT_SLANT "\\([ior]\\)" /* 3 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3848 #define FONT_SLANT_Q "\\([^-]?\\)" /* 3 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3849 #define FONT_SWIDTH "\\([^-]*\\)" /* 4 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3850 #define FONT_ADSTYLE "[^-]*"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3851 #define FONT_PIXELSIZE "[^-]*"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3852 #define FONT_POINTSIZE "\\([0-9][0-9]+\\|\\*\\)" /* 5 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3853 #define FONT_RESX "[0-9][0-9]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3854 #define FONT_RESY "[0-9][0-9]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3855 #define FONT_SPACING "[cmp?*]"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3856 #define FONT_AVGWIDTH "[0-9]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3857 #define FONT_REGISTRY "[^-]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3858 #define FONT_ENCODING "[^-]+"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3859
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3860 #define FONT_REGEXP ("\\`\\*?[-?*]" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3861 FONT_FOUNDRY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3862 FONT_FAMILY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3863 FONT_WEIGHT_Q "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3864 FONT_SLANT_Q "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3865 FONT_SWIDTH "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3866 FONT_ADSTYLE "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3867 FONT_PIXELSIZE "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3868 FONT_POINTSIZE "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3869 "[-?*]\\|\\'")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3870
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3871 #define FONT_REGEXP_HEAD ("\\`[-?*]" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3872 FONT_FOUNDRY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3873 FONT_FAMILY "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3874 FONT_WEIGHT_Q "-" \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3875 FONT_SLANT_Q \
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3876 "\\([-*?]\\|\\'\\)")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3877
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3878 #define FONT_REGEXP_SLANT "-" FONT_SLANT "-"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3879 #define FONT_REGEXP_WEIGHT "-" FONT_WEIGHT "-"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3880
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3881 LONG
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3882 x_to_win32_weight (lpw)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3883 char * lpw;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3884 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3885 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
3886
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3887 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
3888 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
3889 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
3890 else if (stricmp (lpw,"demibold") == 0) return FW_SEMIBOLD;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3891 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
3892 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
3893 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
3894 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
3895 else if (stricmp (lpw,"thin") == 0) return FW_THIN;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3896 else
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3897 return FW_DONTCARE;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3898 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3899
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3900
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3901 char *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3902 win32_to_x_weight (fnweight)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3903 int fnweight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3904 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3905 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
3906 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
3907 if (fnweight >= FW_BOLD) return "bold";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3908 if (fnweight >= FW_SEMIBOLD) return "semibold";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3909 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
3910 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
3911 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
3912 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
3913 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
3914 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3915 return "*";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3916 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3917
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3918 LONG
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3919 x_to_win32_charset (lpcs)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3920 char * lpcs;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3921 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3922 if (!lpcs) return (0);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3923
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3924 if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3925 else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3926 else if (stricmp (lpcs,"iso8859") == 0) return ANSI_CHARSET;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3927 else if (stricmp (lpcs,"oem") == 0) return OEM_CHARSET;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3928 #ifdef UNICODE_CHARSET
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3929 else if (stricmp (lpcs,"unicode") == 0) return UNICODE_CHARSET;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3930 else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3931 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3932 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3933 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3934 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3935
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3936 char *
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3937 win32_to_x_charset (fncharset)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3938 int fncharset;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3939 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3940 switch (fncharset)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3941 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3942 case ANSI_CHARSET: return "ansi";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3943 case OEM_CHARSET: return "oem";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3944 case SYMBOL_CHARSET: return "symbol";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3945 #ifdef UNICODE_CHARSET
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3946 case UNICODE_CHARSET: return "unicode";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3947 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3948 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3949 return "*";
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3950 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3951
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3952 BOOL
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3953 win32_to_x_font (lplogfont, lpxstr, len)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3954 LOGFONT * lplogfont;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3955 char * lpxstr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3956 int len;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3957 {
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3958 char height_pixels[8];
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3959 char height_dpi[8];
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3960 char width_pixels[8];
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3961
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3962 if (!lpxstr) abort ();
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3963
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3964 if (!lplogfont)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3965 return FALSE;
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3966
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3967 if (lplogfont->lfHeight)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3968 {
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3969 sprintf (height_pixels, "%u", abs (lplogfont->lfHeight));
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3970 sprintf (height_dpi, "%u",
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3971 (abs (lplogfont->lfHeight) * 720) / one_win32_display_info.height_in);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3972 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3973 else
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3974 {
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3975 strcpy (height_pixels, "*");
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3976 strcpy (height_dpi, "*");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3977 }
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3978 if (lplogfont->lfWidth)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3979 sprintf (width_pixels, "%u", lplogfont->lfWidth * 10);
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3980 else
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3981 strcpy (width_pixels, "*");
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3982
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3983 _snprintf (lpxstr, len - 1,
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3984 "-*-%s-%s-%c-*-*-%s-%s-*-*-%c-%s-*-%s-",
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3985 lplogfont->lfFaceName,
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3986 win32_to_x_weight (lplogfont->lfWeight),
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3987 lplogfont->lfItalic?'i':'r',
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3988 height_pixels,
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3989 height_dpi,
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3990 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) ? 'p' : 'c',
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3991 width_pixels,
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3992 win32_to_x_charset (lplogfont->lfCharSet)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3993 );
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3994
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3995 lpxstr[len - 1] = 0; /* just to be sure */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3996 return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3997 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3998
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3999 BOOL
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4000 x_to_win32_font (lpxstr, lplogfont)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4001 char * lpxstr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4002 LOGFONT * lplogfont;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4003 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4004 if (!lplogfont) return (FALSE);
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 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
4007
15380
8b01836a6b06 (x_to_win32_font): Allow any quality fonts.
Richard M. Stallman <rms@gnu.org>
parents: 15377
diff changeset
4008 #if 1
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4009 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4010 lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4011 lplogfont->lfQuality = DEFAULT_QUALITY;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4012 #else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4013 /* go for maximum quality */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4014 lplogfont->lfOutPrecision = OUT_STROKE_PRECIS;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4015 lplogfont->lfClipPrecision = CLIP_STROKE_PRECIS;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4016 lplogfont->lfQuality = PROOF_QUALITY;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4017 #endif
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 if (!lpxstr)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4020 return FALSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4021
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4022 /* 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
4023 * 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
4024 * format:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4025 * "<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
4026 */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4027
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4028 if (*lpxstr == '-')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4029 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4030 int fields;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4031 char name[50], weight[20], slant, pitch, pixels[10], height[10], width[10], remainder[20];
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4032 char * encoding;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4033
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4034 fields = sscanf (lpxstr,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4035 "-%*[^-]-%49[^-]-%19[^-]-%c-%*[^-]-%*[^-]-%9[^-]-%9[^-]-%*[^-]-%*[^-]-%c-%9[^-]-%19s",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4036 name, weight, &slant, pixels, height, &pitch, width, remainder);
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 if (fields == EOF) return (FALSE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4039
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4040 if (fields > 0 && name[0] != '*')
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 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
4043 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
4044 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4045 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4046 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4047 lplogfont->lfFaceName[0] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4048 }
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 fields--;
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 lplogfont->lfWeight = x_to_win32_weight ((fields > 0 ? weight : ""));
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4053
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4054 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4055
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4056 if (!NILP (Vwin32_enable_italics))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4057 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
4058
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4059 fields--;
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 if (fields > 0 && pixels[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4062 lplogfont->lfHeight = atoi (pixels);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4063
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4064 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4065
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4066 if (fields > 0 && lplogfont->lfHeight == 0 && height[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4067 lplogfont->lfHeight = (atoi (height)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4068 * one_win32_display_info.height_in) / 720;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4069
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4070 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4071
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4072 lplogfont->lfPitchAndFamily =
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4073 (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
4074
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4075 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4076
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4077 if (fields > 0 && width[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4078 lplogfont->lfWidth = atoi (width) / 10;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4079
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4080 fields--;
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 /* Not all font specs include the registry field, so we allow for an
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4083 optional registry field before the encoding when parsing
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4084 remainder. Also we strip the trailing '-' if present. */
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4085 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4086 int len = strlen (remainder);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4087 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
4088 remainder[len-1] = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4089 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4090 encoding = remainder;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4091 if (strncmp (encoding, "*-", 2) == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4092 encoding += 2;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4093 lplogfont->lfCharSet = x_to_win32_charset (fields > 0 ? encoding : "");
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4094 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4095 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4096 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4097 int fields;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4098 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
4099
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4100 fields = sscanf (lpxstr,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4101 "%99[^:]:%9[^:]:%9[^:]:%19s",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4102 name, height, width, weight);
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 if (fields == EOF) return (FALSE);
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 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4107 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4108 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
4109 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
4110 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4111 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4112 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4113 lplogfont->lfFaceName[0] = 0;
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
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4116 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4117
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4118 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4119 lplogfont->lfHeight = atoi (height);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4120
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4121 fields--;
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 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4124 lplogfont->lfWidth = atoi (width);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4125
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4126 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4127
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4128 lplogfont->lfWeight = x_to_win32_weight ((fields > 0 ? weight : ""));
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4129 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4130
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4131 /* 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
4132 lplogfont->lfHeight = - abs (lplogfont->lfHeight);
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 return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4135 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4136
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4137 BOOL
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4138 win32_font_match (lpszfont1, lpszfont2)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4139 char * lpszfont1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4140 char * lpszfont2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4141 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4142 char * s1 = lpszfont1, *e1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4143 char * s2 = lpszfont2, *e2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4144
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4145 if (s1 == NULL || s2 == NULL) return (FALSE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4146
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4147 if (*s1 == '-') s1++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4148 if (*s2 == '-') s2++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4149
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4150 while (1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4151 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4152 int len1, len2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4153
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4154 e1 = strchr (s1, '-');
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4155 e2 = strchr (s2, '-');
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4156
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4157 if (e1 == NULL || e2 == NULL) return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4158
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4159 len1 = e1 - s1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4160 len2 = e2 - s2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4161
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4162 if (*s1 != '*' && *s2 != '*'
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4163 && (len1 != len2 || strnicmp (s1, s2, len1) != 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4164 return (FALSE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4165
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4166 s1 = e1 + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4167 s2 = e2 + 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4168 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4169 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4170
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4171 typedef struct enumfont_t
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4172 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4173 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4174 int numFonts;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4175 LOGFONT logfont;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4176 XFontStruct *size_ref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4177 Lisp_Object *pattern;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4178 Lisp_Object *head;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4179 Lisp_Object *tail;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4180 } enumfont_t;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4181
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4182 int CALLBACK
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4183 enum_font_cb2 (lplf, lptm, FontType, lpef)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4184 ENUMLOGFONT * lplf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4185 NEWTEXTMETRIC * lptm;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4186 int FontType;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4187 enumfont_t * lpef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4188 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4189 if (lplf->elfLogFont.lfStrikeOut || lplf->elfLogFont.lfUnderline
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4190 || (lplf->elfLogFont.lfCharSet != ANSI_CHARSET && lplf->elfLogFont.lfCharSet != OEM_CHARSET))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4191 return (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4192
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4193 /* if (!lpef->size_ref || lptm->tmMaxCharWidth == FONT_WIDTH (lpef->size_ref)) */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4194 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4195 char buf[100];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4196
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4197 if (!NILP (*(lpef->pattern)) && FontType == TRUETYPE_FONTTYPE)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4198 {
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4199 lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight;
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4200 lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth;
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4201 }
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4202
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4203 if (!win32_to_x_font (lplf, buf, 100)) return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4204
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4205 if (NILP (*(lpef->pattern)) || win32_font_match (buf, XSTRING (*(lpef->pattern))->data))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4206 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4207 *lpef->tail = Fcons (build_string (buf), Qnil);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4208 lpef->tail = &XCONS (*lpef->tail)->cdr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4209 lpef->numFonts++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4210 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4211 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4212
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4213 return (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4214 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4215
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4216 int CALLBACK
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4217 enum_font_cb1 (lplf, lptm, FontType, lpef)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4218 ENUMLOGFONT * lplf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4219 NEWTEXTMETRIC * lptm;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4220 int FontType;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4221 enumfont_t * lpef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4222 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4223 return EnumFontFamilies (lpef->hdc,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4224 lplf->elfLogFont.lfFaceName,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4225 (FONTENUMPROC) enum_font_cb2,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4226 (LPARAM) lpef);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4227 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4228
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4229
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4230 DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 3, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4231 "Return a list of the names of available fonts matching PATTERN.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4232 If optional arguments FACE and FRAME are specified, return only fonts\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4233 the same size as FACE on FRAME.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4234 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4235 PATTERN is a string, perhaps with wildcard characters;\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4236 the * character matches any substring, and\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4237 the ? character matches any single character.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4238 PATTERN is case-insensitive.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4239 FACE is a face name--a symbol.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4240 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4241 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
4242 set-face-font.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4243 \n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4244 Fonts Emacs can't use (i.e. proportional fonts) may or may not be excluded\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4245 even if they match PATTERN and FACE.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4246 (pattern, face, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4247 Lisp_Object pattern, face, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4248 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4249 int num_fonts;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4250 char **names;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4251 XFontStruct *info;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4252 XFontStruct *size_ref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4253 Lisp_Object namelist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4254 Lisp_Object list;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4255 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4256 enumfont_t ef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4257
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4258 CHECK_STRING (pattern, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4259 if (!NILP (face))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4260 CHECK_SYMBOL (face, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4261
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4262 f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4263
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4264 /* Determine the width standard for comparison with the fonts we find. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4265
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4266 if (NILP (face))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4267 size_ref = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4268 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4269 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4270 int face_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4271
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4272 /* Don't die if we get called with a terminal frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4273 if (! FRAME_WIN32_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4274 error ("non-win32 frame used in `x-list-fonts'");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4275
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4276 face_id = face_name_id_number (f, face);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4277
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4278 if (face_id < 0 || face_id >= FRAME_N_PARAM_FACES (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4279 || FRAME_PARAM_FACES (f) [face_id] == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4280 size_ref = f->output_data.win32->font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4281 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4282 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4283 size_ref = FRAME_PARAM_FACES (f) [face_id]->font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4284 if (size_ref == (XFontStruct *) (~0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4285 size_ref = f->output_data.win32->font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4286 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4287 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4288
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4289 /* See if we cached the result for this particular query. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4290 list = Fassoc (pattern,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4291 XCONS (FRAME_WIN32_DISPLAY_INFO (f)->name_list_element)->cdr);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4292
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4293 /* We have info in the cache for this PATTERN. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4294 if (!NILP (list))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4295 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4296 Lisp_Object tem, newlist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4297
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4298 /* We have info about this pattern. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4299 list = XCONS (list)->cdr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4300
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4301 if (size_ref == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4302 return list;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4303
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4304 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4305
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4306 /* Filter the cached info and return just the fonts that match FACE. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4307 newlist = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4308 for (tem = list; CONSP (tem); tem = XCONS (tem)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4309 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4310 XFontStruct *thisinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4311
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4312 thisinfo = win32_load_font (FRAME_WIN32_DISPLAY_INFO (f), XSTRING (XCONS (tem)->car)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4313
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4314 if (thisinfo && same_size_fonts (thisinfo, size_ref))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4315 newlist = Fcons (XCONS (tem)->car, newlist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4316
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4317 win32_unload_font (FRAME_WIN32_DISPLAY_INFO (f), thisinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4318 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4319
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4320 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4321
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4322 return newlist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4323 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4324
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4325 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4326
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4327 namelist = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4328 ef.pattern = &pattern;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4329 ef.tail = ef.head = &namelist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4330 ef.numFonts = 0;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
4331 x_to_win32_font (STRINGP (pattern) ? XSTRING (pattern)->data : NULL, &ef.logfont);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4332
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4333 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4334 ef.hdc = GetDC (FRAME_WIN32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4335
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4336 EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1, (LPARAM)&ef);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4337
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4338 ReleaseDC (FRAME_WIN32_WINDOW (f), ef.hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4339 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4340
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4341 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4342
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4343 if (ef.numFonts)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4344 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4345 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4346 Lisp_Object cur;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4347
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4348 /* Make a list of all the fonts we got back.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4349 Store that in the font cache for the display. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4350 XCONS (FRAME_WIN32_DISPLAY_INFO (f)->name_list_element)->cdr
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4351 = Fcons (Fcons (pattern, namelist),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4352 XCONS (FRAME_WIN32_DISPLAY_INFO (f)->name_list_element)->cdr);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4353
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4354 /* Make a list of the fonts that have the right width. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4355 list = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4356 cur=namelist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4357 for (i = 0; i < ef.numFonts; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4358 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4359 int keeper;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4360
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4361 if (!size_ref)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4362 keeper = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4363 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4364 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4365 XFontStruct *thisinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4366
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4367 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4368 thisinfo = win32_load_font (FRAME_WIN32_DISPLAY_INFO (f), XSTRING (Fcar (cur))->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4369
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4370 keeper = thisinfo && same_size_fonts (thisinfo, size_ref);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4371
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4372 win32_unload_font (FRAME_WIN32_DISPLAY_INFO (f), thisinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4373
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4374 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4375 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4376 if (keeper)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4377 list = Fcons (build_string (XSTRING (Fcar (cur))->data), list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4378
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4379 cur = Fcdr (cur);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4380 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4381 list = Fnreverse (list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4382 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4383
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4384 return list;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4385 }
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 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
4388 "Return non-nil if color COLOR is supported on frame FRAME.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4389 If FRAME is omitted or nil, use the selected frame.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4390 (color, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4391 Lisp_Object color, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4392 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4393 COLORREF foo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4394 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4395
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4396 CHECK_STRING (color, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4397
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4398 if (defined_color (f, XSTRING (color)->data, &foo, 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4399 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4400 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4401 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4402 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4403
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4404 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
4405 "Return a description of the color named COLOR on frame FRAME.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4406 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
4407 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
4408 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
4409 If FRAME is omitted or nil, use the selected frame.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4410 (color, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4411 Lisp_Object color, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4412 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4413 COLORREF foo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4414 FRAME_PTR f = check_x_frame (frame);
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 CHECK_STRING (color, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4417
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4418 if (defined_color (f, XSTRING (color)->data, &foo, 0))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4419 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4420 Lisp_Object rgb[3];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4421
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4422 rgb[0] = make_number (GetRValue (foo));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4423 rgb[1] = make_number (GetGValue (foo));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4424 rgb[2] = make_number (GetBValue (foo));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4425 return Flist (3, rgb);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4426 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4427 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4428 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4429 }
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 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
4432 "Return t if the X display supports color.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4433 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4434 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
4435 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4436 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4437 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4438 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4439 struct win32_display_info *dpyinfo = check_x_display_info (display);
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 ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 2)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4442 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4443
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4444 return Qt;
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4447 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
4448 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4449 "Return t if the X display supports shades of gray.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4450 Note that color displays do support shades of gray.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4451 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4452 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
4453 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4454 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4455 Lisp_Object display;
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 struct win32_display_info *dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4458
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4459 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4460 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4461
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4462 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4463 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4464
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4465 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
4466 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4467 "Returns the width in pixels of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4468 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4469 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
4470 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4471 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4472 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4473 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4474 struct win32_display_info *dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4475
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4476 return make_number (dpyinfo->width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4477 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4478
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4479 DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4480 Sx_display_pixel_height, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4481 "Returns the height in pixels of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4482 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4483 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
4484 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4485 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4486 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4487 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4488 struct win32_display_info *dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4489
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4490 return make_number (dpyinfo->height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4491 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4492
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4493 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4494 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4495 "Returns the number of bitplanes of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4496 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4497 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
4498 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4499 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4500 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4501 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4502 struct win32_display_info *dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4503
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4504 return make_number (dpyinfo->n_planes * dpyinfo->n_cbits);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4505 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4506
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4507 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
4508 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4509 "Returns the number of color cells of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4510 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4511 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
4512 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4513 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4514 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4515 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4516 struct win32_display_info *dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4517 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4518 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4519
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4520 hdc = GetDC (dpyinfo->root_window);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4521 if (dpyinfo->has_palette)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4522 cap = GetDeviceCaps (hdc,SIZEPALETTE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4523 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4524 cap = GetDeviceCaps (hdc,NUMCOLORS);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4525
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4526 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4527
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4528 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4529 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4530
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4531 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4532 Sx_server_max_request_size,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4533 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4534 "Returns the maximum request size of the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4535 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4536 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
4537 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4538 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4539 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4540 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4541 struct win32_display_info *dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4542
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4543 return make_number (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4544 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4545
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4546 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4547 "Returns the vendor ID string of the Win32 system (Microsoft).\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4548 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4549 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
4550 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4551 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4552 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4553 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4554 struct win32_display_info *dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4555 char *vendor = "Microsoft Corp.";
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4556
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4557 if (! vendor) vendor = "";
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4558 return build_string (vendor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4559 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4560
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4561 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
4562 "Returns the version numbers of the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4563 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
4564 version numbers, and the vendor-specific release\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4565 number. See also the function `x-server-vendor'.\n\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4566 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4567 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
4568 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4569 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4570 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4571 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4572 struct win32_display_info *dpyinfo = check_x_display_info (display);
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 return Fcons (make_number (nt_major_version),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4575 Fcons (make_number (nt_minor_version), Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4576 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4577
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4578 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
4579 "Returns the number of screens on the server of display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4580 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4581 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
4582 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4583 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4584 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4585 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4586 struct win32_display_info *dpyinfo = check_x_display_info (display);
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 return make_number (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4589 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4590
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4591 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
4592 "Returns the height in millimeters of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4593 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4594 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
4595 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4596 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4597 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4598 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4599 struct win32_display_info *dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4600 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4601 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4602
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4603 hdc = GetDC (dpyinfo->root_window);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4604
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4605 cap = GetDeviceCaps (hdc, VERTSIZE);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4606
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4607 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4608
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4609 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4610 }
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 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
4613 "Returns the width in millimeters of the X display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4614 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4615 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
4616 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4617 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4618 Lisp_Object display;
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 struct win32_display_info *dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4621
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4622 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4623 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4624
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4625 hdc = GetDC (dpyinfo->root_window);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4626
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4627 cap = GetDeviceCaps (hdc, HORZSIZE);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4628
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4629 ReleaseDC (dpyinfo->root_window, hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4630
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4631 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4632 }
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 DEFUN ("x-display-backing-store", Fx_display_backing_store,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4635 Sx_display_backing_store, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4636 "Returns an indication of whether display DISPLAY does backing store.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4637 The value may be `always', `when-mapped', or `not-useful'.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4638 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4639 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
4640 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4641 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4642 Lisp_Object display;
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 return intern ("not-useful");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4645 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4646
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4647 DEFUN ("x-display-visual-class", Fx_display_visual_class,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4648 Sx_display_visual_class, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4649 "Returns the visual class of the display DISPLAY.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4650 The value is one of the symbols `static-gray', `gray-scale',\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4651 `static-color', `pseudo-color', `true-color', or `direct-color'.\n\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4652 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4653 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
4654 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4655 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4656 Lisp_Object display;
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 struct win32_display_info *dpyinfo = check_x_display_info (display);
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 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4661 switch (dpyinfo->visual->class)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4662 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4663 case StaticGray: return (intern ("static-gray"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4664 case GrayScale: return (intern ("gray-scale"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4665 case StaticColor: return (intern ("static-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4666 case PseudoColor: return (intern ("pseudo-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4667 case TrueColor: return (intern ("true-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4668 case DirectColor: return (intern ("direct-color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4669 default:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4670 error ("Display has an unknown visual class");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4671 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4672 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4673
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4674 error ("Display has an unknown visual class");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4675 }
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 DEFUN ("x-display-save-under", Fx_display_save_under,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4678 Sx_display_save_under, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4679 "Returns t if the display DISPLAY supports the save-under feature.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4680 The optional argument DISPLAY specifies which display to ask about.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4681 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
4682 If omitted or nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4683 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4684 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4685 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4686 struct win32_display_info *dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4687
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4688 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4689 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4690
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4691 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4692 x_pixel_width (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4693 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4694 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4695 return PIXEL_WIDTH (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4696 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4697
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4698 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4699 x_pixel_height (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4700 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4701 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4702 return PIXEL_HEIGHT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4703 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4704
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4705 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4706 x_char_width (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4707 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4708 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4709 return FONT_WIDTH (f->output_data.win32->font);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4712 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4713 x_char_height (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4714 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4715 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4716 return f->output_data.win32->line_height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4717 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4718
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4719 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4720 x_screen_planes (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4721 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4722 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4723 return (FRAME_WIN32_DISPLAY_INFO (XFRAME (frame))->n_planes *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4724 FRAME_WIN32_DISPLAY_INFO (XFRAME (frame))->n_cbits);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4725 }
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 /* Return the display structure for the display named NAME.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4728 Open a new connection if necessary. */
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 struct win32_display_info *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4731 x_display_info_for_name (name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4732 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4733 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4734 Lisp_Object names;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4735 struct win32_display_info *dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4736
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4737 CHECK_STRING (name, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4738
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4739 for (dpyinfo = &one_win32_display_info, names = win32_display_name_list;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4740 dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4741 dpyinfo = dpyinfo->next, names = XCONS (names)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4742 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4743 Lisp_Object tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4744 tem = Fstring_equal (XCONS (XCONS (names)->car)->car, name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4745 if (!NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4746 return dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4747 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4748
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4749 /* Use this general default value to start with. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4750 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4751
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4752 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4753
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4754 dpyinfo = win32_term_init (name, (unsigned char *)0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4755 (char *) XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4756
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4757 if (dpyinfo == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4758 error ("Cannot connect to server %s", XSTRING (name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4759
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4760 XSETFASTINT (Vwindow_system_version, 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4761
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4762 return dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4763 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4764
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4765 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4766 1, 3, 0, "Open a connection to a server.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4767 DISPLAY is the name of the display to connect to.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4768 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
4769 If the optional third arg MUST-SUCCEED is non-nil,\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4770 terminate Emacs if we can't open the connection.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4771 (display, xrm_string, must_succeed)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4772 Lisp_Object display, xrm_string, must_succeed;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4773 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4774 unsigned int n_planes;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4775 unsigned char *xrm_option;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4776 struct win32_display_info *dpyinfo;
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 CHECK_STRING (display, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4779 if (! NILP (xrm_string))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4780 CHECK_STRING (xrm_string, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4781
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4782 /* 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
4783 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
4784 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4785 Lisp_Object color_file;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4786 struct gcpro gcpro1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4787
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4788 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
4789
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4790 GCPRO1 (color_file);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4791
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4792 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
4793 color_file =
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4794 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
4795 Fsymbol_value (intern ("data-directory")));
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4796
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4797 Vwin32_color_map = Fwin32_load_color_file (color_file);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4798
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4799 UNGCPRO;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4800 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4801 if (NILP (Vwin32_color_map))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4802 Vwin32_color_map = Fwin32_default_color_map ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4803
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4804 if (! NILP (xrm_string))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4805 xrm_option = (unsigned char *) XSTRING (xrm_string)->data;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4806 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4807 xrm_option = (unsigned char *) 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4808
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4809 /* 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
4810 /* 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
4811 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4812 char basename[ MAX_PATH ], *str;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4813
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4814 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
4815 str = strrchr (basename, '.');
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4816 if (str) *str = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4817 Vinvocation_name = build_string (basename);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4818 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4819 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4820
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4821 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4822
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4823 /* This is what opens the connection and sets x_current_display.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4824 This also initializes many symbols, such as those used for input. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4825 dpyinfo = win32_term_init (display, xrm_option,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4826 (char *) XSTRING (Vx_resource_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4827
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4828 if (dpyinfo == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4829 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4830 if (!NILP (must_succeed))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4831 fatal ("Cannot connect to server %s.\n",
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4832 XSTRING (display)->data);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4833 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4834 error ("Cannot connect to server %s", XSTRING (display)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4835 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4836
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4837 XSETFASTINT (Vwindow_system_version, 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4838 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4839 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4840
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4841 DEFUN ("x-close-connection", Fx_close_connection,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4842 Sx_close_connection, 1, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4843 "Close the connection to DISPLAY's server.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4844 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
4845 If DISPLAY is nil, that stands for the selected frame's display.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4846 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4847 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4848 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4849 struct win32_display_info *dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4850 struct win32_display_info *tail;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4851 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4852
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4853 if (dpyinfo->reference_count > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4854 error ("Display still has frames on it");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4855
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4856 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4857 /* Free the fonts in the font table. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4858 for (i = 0; i < dpyinfo->n_fonts; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4859 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4860 if (dpyinfo->font_table[i].name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4861 free (dpyinfo->font_table[i].name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4862 /* Don't free the full_name string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4863 it is always shared with something else. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4864 win32_unload_font (dpyinfo, dpyinfo->font_table[i].font);
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 x_destroy_all_bitmaps (dpyinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4867
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4868 x_delete_display (dpyinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4869 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4870
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4871 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4872 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4873
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4874 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
4875 "Return the list of display names that Emacs has connections to.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4876 ()
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 Lisp_Object tail, result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4879
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4880 result = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4881 for (tail = win32_display_name_list; ! NILP (tail); tail = XCONS (tail)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4882 result = Fcons (XCONS (XCONS (tail)->car)->car, result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4883
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4884 return result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4885 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4886
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4887 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4888 "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
4889 If ON is nil, allow buffering of requests.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4890 This is a noop on Win32 systems.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4891 The optional second argument DISPLAY specifies which display to act on.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4892 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
4893 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
4894 (on, display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4895 Lisp_Object display, on;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4896 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4897 struct win32_display_info *dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4898
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4899 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4900 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4901
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4902
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4903 /* These are the win32 specialized functions */
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 DEFUN ("win32-select-font", Fwin32_select_font, Swin32_select_font, 0, 1, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4906 "This will display the Win32 font dialog and return an X font string corresponding to the selection.")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4907 (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4908 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4909 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4910 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4911 CHOOSEFONT cf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4912 LOGFONT lf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4913 char buf[100];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4914
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4915 bzero (&cf, sizeof (cf));
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 cf.lStructSize = sizeof (cf);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4918 cf.hwndOwner = FRAME_WIN32_WINDOW (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4919 cf.Flags = CF_FIXEDPITCHONLY | CF_FORCEFONTEXIST | CF_SCREENFONTS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4920 cf.lpLogFont = &lf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4921
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4922 if (!ChooseFont (&cf) || !win32_to_x_font (&lf, buf, 100))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4923 return Qnil;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4924
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4925 return build_string (buf);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4926 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4927
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4928
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4929 syms_of_win32fns ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4930 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4931 /* 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
4932 just above where these variables are declared. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4933 /*&&& init symbols here &&&*/
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4934 Qauto_raise = intern ("auto-raise");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4935 staticpro (&Qauto_raise);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4936 Qauto_lower = intern ("auto-lower");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4937 staticpro (&Qauto_lower);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4938 Qbackground_color = intern ("background-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4939 staticpro (&Qbackground_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4940 Qbar = intern ("bar");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4941 staticpro (&Qbar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4942 Qborder_color = intern ("border-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4943 staticpro (&Qborder_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4944 Qborder_width = intern ("border-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4945 staticpro (&Qborder_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4946 Qbox = intern ("box");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4947 staticpro (&Qbox);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4948 Qcursor_color = intern ("cursor-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4949 staticpro (&Qcursor_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4950 Qcursor_type = intern ("cursor-type");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4951 staticpro (&Qcursor_type);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4952 Qforeground_color = intern ("foreground-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4953 staticpro (&Qforeground_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4954 Qgeometry = intern ("geometry");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4955 staticpro (&Qgeometry);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4956 Qicon_left = intern ("icon-left");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4957 staticpro (&Qicon_left);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4958 Qicon_top = intern ("icon-top");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4959 staticpro (&Qicon_top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4960 Qicon_type = intern ("icon-type");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4961 staticpro (&Qicon_type);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4962 Qicon_name = intern ("icon-name");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4963 staticpro (&Qicon_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4964 Qinternal_border_width = intern ("internal-border-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4965 staticpro (&Qinternal_border_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4966 Qleft = intern ("left");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4967 staticpro (&Qleft);
16259
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
4968 Qright = intern ("right");
f54af1701a5f (Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 16106
diff changeset
4969 staticpro (&Qright);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4970 Qmouse_color = intern ("mouse-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4971 staticpro (&Qmouse_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4972 Qnone = intern ("none");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4973 staticpro (&Qnone);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4974 Qparent_id = intern ("parent-id");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4975 staticpro (&Qparent_id);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4976 Qscroll_bar_width = intern ("scroll-bar-width");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4977 staticpro (&Qscroll_bar_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4978 Qsuppress_icon = intern ("suppress-icon");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4979 staticpro (&Qsuppress_icon);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4980 Qtop = intern ("top");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4981 staticpro (&Qtop);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4982 Qundefined_color = intern ("undefined-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4983 staticpro (&Qundefined_color);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4984 Qvertical_scroll_bars = intern ("vertical-scroll-bars");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4985 staticpro (&Qvertical_scroll_bars);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4986 Qvisibility = intern ("visibility");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4987 staticpro (&Qvisibility);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4988 Qwindow_id = intern ("window-id");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4989 staticpro (&Qwindow_id);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4990 Qx_frame_parameter = intern ("x-frame-parameter");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4991 staticpro (&Qx_frame_parameter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4992 Qx_resource_name = intern ("x-resource-name");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4993 staticpro (&Qx_resource_name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4994 Quser_position = intern ("user-position");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4995 staticpro (&Quser_position);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4996 Quser_size = intern ("user-size");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4997 staticpro (&Quser_size);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4998 Qdisplay = intern ("display");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4999 staticpro (&Qdisplay);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5000 /* This is the end of symbol initialization. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5001
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5002 Fput (Qundefined_color, Qerror_conditions,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5003 Fcons (Qundefined_color, Fcons (Qerror, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5004 Fput (Qundefined_color, Qerror_message,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5005 build_string ("Undefined color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5006
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5007 DEFVAR_LISP ("win32-color-map", &Vwin32_color_map,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5008 "A array of color name mappings for windows.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5009 Vwin32_color_map = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5010
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
5011 DEFVAR_LISP ("win32-pass-alt-to-system", &Vwin32_pass_alt_to_system,
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
5012 "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
5013 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
5014 open the System menu. When nil, Emacs silently swallows alt key events.");
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
5015 Vwin32_pass_alt_to_system = Qnil;
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
5016
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
5017 DEFVAR_LISP ("win32-alt-is-meta", &Vwin32_alt_is_meta,
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
5018 "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
5019 When nil, Emacs will translate the alt key to the Alt modifier, and not Meta.");
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
5020 Vwin32_alt_is_meta = Qt;
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
5021
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
5022 DEFVAR_LISP ("win32-pass-optional-keys-to-system",
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
5023 &Vwin32_pass_optional_keys_to_system,
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
5024 "Non-nil if the 'optional' keys (left window, right window,\n\
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
5025 and application keys) are passed on to Windows.");
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
5026 Vwin32_pass_optional_keys_to_system = Qnil;
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
5027
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5028 DEFVAR_LISP ("win32-enable-italics", &Vwin32_enable_italics,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5029 "Non-nil enables selection of artificially italicized fonts.");
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5030 Vwin32_enable_italics = Qnil;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5031
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5032 DEFVAR_LISP ("win32-enable-palette", &Vwin32_enable_palette,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5033 "Non-nil enables Windows palette management to map colors exactly.");
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5034 Vwin32_enable_palette = Qt;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5035
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5036 DEFVAR_INT ("win32-mouse-button-tolerance",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5037 &Vwin32_mouse_button_tolerance,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5038 "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
5039 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
5040 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
5041 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
5042 button down event is generated instead.");
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5043 XSETINT (Vwin32_mouse_button_tolerance, GetDoubleClickTime () / 2);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5044
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
5045 DEFVAR_INT ("win32-mouse-move-interval",
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
5046 &Vwin32_mouse_move_interval,
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
5047 "Minimum interval between mouse move events.\n\
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
5048 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
5049 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
5050 reported as lisp events.");
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
5051 XSETINT (Vwin32_mouse_move_interval, 50);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
5052
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5053 init_x_parm_symbols ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5054
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5055 DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5056 "List of directories to search for bitmap files for win32.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5057 Vx_bitmap_file_path = decode_env_path ((char *) 0, "PATH");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5058
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5059 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5060 "The shape of the pointer when over text.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5061 Changing the value does not affect existing frames\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5062 unless you set the mouse color.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5063 Vx_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5064
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5065 DEFVAR_LISP ("x-resource-name", &Vx_resource_name,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5066 "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
5067 `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
5068 when requesting resource values.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5069 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
5070 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
5071 switches, if present.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5072 Vx_resource_name = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5073
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5074 Vx_nontext_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5075
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5076 Vx_mode_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5077
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5078 DEFVAR_INT ("x-sensitive-text-pointer-shape",
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5079 &Vx_sensitive_text_pointer_shape,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5080 "The shape of the pointer when over mouse-sensitive text.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5081 This variable takes effect when you create a new frame\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5082 or when you set the mouse color.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5083 Vx_sensitive_text_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5084
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5085 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5086 "A string indicating the foreground color of the cursor box.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5087 Vx_cursor_fore_pixel = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5088
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5089 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5090 "Non-nil if no window manager is in use.\n\
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5091 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
5092 unless you set it to something else.");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5093 /* 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
5094 and maybe the user would like to set it to t. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5095 Vx_no_window_manager = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5096
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5097 defsubr (&Sx_get_resource);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5098 defsubr (&Sx_list_fonts);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5099 defsubr (&Sx_display_color_p);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5100 defsubr (&Sx_display_grayscale_p);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5101 defsubr (&Sx_color_defined_p);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5102 defsubr (&Sx_color_values);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5103 defsubr (&Sx_server_max_request_size);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5104 defsubr (&Sx_server_vendor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5105 defsubr (&Sx_server_version);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5106 defsubr (&Sx_display_pixel_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5107 defsubr (&Sx_display_pixel_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5108 defsubr (&Sx_display_mm_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5109 defsubr (&Sx_display_mm_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5110 defsubr (&Sx_display_screens);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5111 defsubr (&Sx_display_planes);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5112 defsubr (&Sx_display_color_cells);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5113 defsubr (&Sx_display_visual_class);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5114 defsubr (&Sx_display_backing_store);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5115 defsubr (&Sx_display_save_under);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5116 defsubr (&Sx_parse_geometry);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5117 defsubr (&Sx_create_frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5118 defsubr (&Sfocus_frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5119 defsubr (&Sunfocus_frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5120 defsubr (&Sx_open_connection);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5121 defsubr (&Sx_close_connection);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5122 defsubr (&Sx_display_list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5123 defsubr (&Sx_synchronize);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5124
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5125 /* Win32 specific functions */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5126
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5127 defsubr (&Swin32_select_font);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5128 defsubr (&Swin32_define_rgb_color);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5129 defsubr (&Swin32_default_color_map);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5130 defsubr (&Swin32_load_color_file);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5131 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5132
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5133 #undef abort
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5134
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5135 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5136 win32_abort()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5137 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5138 int button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5139 button = MessageBox (NULL,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5140 "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
5141 "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
5142 "Emacs Abort Dialog",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5143 MB_ICONEXCLAMATION | MB_TASKMODAL
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5144 | MB_SETFOREGROUND | MB_ABORTRETRYIGNORE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5145 switch (button)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5146 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5147 case IDRETRY:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5148 DebugBreak ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5149 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5150 case IDIGNORE:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5151 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5152 case IDABORT:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5153 default:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5154 abort ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5155 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5156 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5157 }
15148
220145cf7546 (continuation of previous checkin)
Geoff Voelker <voelker@cs.washington.edu>
parents: 15147
diff changeset
5158