Mercurial > emacs
annotate src/w32fns.c @ 43196:006c566af674
Remove the description of tty-display-color-cells.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Fri, 08 Feb 2002 19:04:27 +0000 |
parents | 20a21fb23284 |
children | 2dc57fcf62e9 |
rev | line source |
---|---|
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
1 /* Graphical user interface functions for the Microsoft W32 API. |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
2 Copyright (C) 1989, 92, 93, 94, 95, 1996, 1997, 1998, 1999, 2000, 2001 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3 Free Software Foundation, Inc. |
13434 | 4 |
5 This file is part of GNU Emacs. | |
6 | |
7 GNU Emacs is free software; you can redistribute it and/or modify | |
8 it under the terms of the GNU General Public License as published by | |
9 the Free Software Foundation; either version 2, or (at your option) | |
10 any later version. | |
11 | |
12 GNU Emacs is distributed in the hope that it will be useful, | |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 GNU General Public License for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with GNU Emacs; see the file COPYING. If not, write to | |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13434
diff
changeset
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13434
diff
changeset
|
20 Boston, MA 02111-1307, USA. */ |
13434 | 21 |
22 /* Added by Kevin Gallo */ | |
23 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
24 #include <config.h> |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
25 |
13434 | 26 #include <signal.h> |
27 #include <stdio.h> | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
28 #include <limits.h> |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
29 #include <errno.h> |
13434 | 30 |
31 #include "lisp.h" | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
32 #include "charset.h" |
31110 | 33 #include "dispextern.h" |
13434 | 34 #include "w32term.h" |
37707
6bc1c4d4eb50
(w32_to_x_font): Change prototype to fit the declaration.
Eli Zaretskii <eliz@gnu.org>
parents:
36594
diff
changeset
|
35 #include "keyboard.h" |
13434 | 36 #include "frame.h" |
37 #include "window.h" | |
38 #include "buffer.h" | |
28272
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
39 #include "fontset.h" |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
40 #include "intervals.h" |
13434 | 41 #include "blockinput.h" |
24412
d11ac02f9d6a
Use epaths.h istead of paths.h.
Richard M. Stallman <rms@gnu.org>
parents:
24339
diff
changeset
|
42 #include "epaths.h" |
16593
4ed80eda6fac
Use new names for w32 files
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
43 #include "w32heap.h" |
13434 | 44 #include "termhooks.h" |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
45 #include "coding.h" |
25069
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
46 #include "ccl.h" |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
47 #include "systime.h" |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
48 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
49 #include "bitmaps/gray.xbm" |
13434 | 50 |
51 #include <commdlg.h> | |
21884 | 52 #include <shellapi.h> |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
53 #include <ctype.h> |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
54 |
13434 | 55 extern void free_frame_menubar (); |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
56 extern void x_compute_fringe_widths P_ ((struct frame *, int)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
57 extern double atof (); |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
58 extern int w32_console_toggle_lock_key P_ ((int, Lisp_Object)); |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
59 extern void w32_menu_display_help P_ ((HWND, HMENU, UINT, UINT)); |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
60 extern void w32_free_menu_strings P_ ((HWND)); |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
61 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
62 extern int quit_char; |
13434 | 63 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
64 /* A definition of XColor for non-X frames. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
65 #ifndef HAVE_X_WINDOWS |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
66 typedef struct { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
67 unsigned long pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
68 unsigned short red, green, blue; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
69 char flags; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
70 char pad; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
71 } XColor; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
72 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
73 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
74 extern char *lispy_function_keys[]; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
75 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
76 /* The gray bitmap `bitmaps/gray'. This is done because w32term.c uses |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
77 it, and including `bitmaps/gray' more than once is a problem when |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
78 config.h defines `static' as an empty replacement string. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
79 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
80 int gray_bitmap_width = gray_width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
81 int gray_bitmap_height = gray_height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
82 unsigned char *gray_bitmap_bits = gray_bits; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
83 |
13434 | 84 /* The colormap for converting color names to RGB values */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
85 Lisp_Object Vw32_color_map; |
13434 | 86 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
87 /* Non nil if alt key presses are passed on to Windows. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
88 Lisp_Object Vw32_pass_alt_to_system; |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
89 |
15459
76ff60cd2b8d
(Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15434
diff
changeset
|
90 /* 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
|
91 to alt_modifier. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
92 Lisp_Object Vw32_alt_is_meta; |
15459
76ff60cd2b8d
(Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15434
diff
changeset
|
93 |
24339
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
94 /* If non-zero, the windows virtual key code for an alternative quit key. */ |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
95 Lisp_Object Vw32_quit_key; |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
96 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
97 /* Non nil if left window key events are passed on to Windows (this only |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
98 affects whether "tapping" the key opens the Start menu). */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
99 Lisp_Object Vw32_pass_lwindow_to_system; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
100 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
101 /* Non nil if right window key events are passed on to Windows (this |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
102 only affects whether "tapping" the key opens the Start menu). */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
103 Lisp_Object Vw32_pass_rwindow_to_system; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
104 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
105 /* Virtual key code used to generate "phantom" key presses in order |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
106 to stop system from acting on Windows key events. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
107 Lisp_Object Vw32_phantom_key_code; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
108 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
109 /* Modifier associated with the left "Windows" key, or nil to act as a |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
110 normal key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
111 Lisp_Object Vw32_lwindow_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
112 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
113 /* Modifier associated with the right "Windows" key, or nil to act as a |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
114 normal key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
115 Lisp_Object Vw32_rwindow_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
116 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
117 /* Modifier associated with the "Apps" key, or nil to act as a normal |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
118 key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
119 Lisp_Object Vw32_apps_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
120 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
121 /* Value is nil if Num Lock acts as a function key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
122 Lisp_Object Vw32_enable_num_lock; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
123 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
124 /* Value is nil if Caps Lock acts as a function key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
125 Lisp_Object Vw32_enable_caps_lock; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
126 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
127 /* Modifier associated with Scroll Lock, or nil to act as a normal key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
128 Lisp_Object Vw32_scroll_lock_modifier; |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
129 |
27894
6c4ff3519d09
(w32_wnd_proc) [WM_LBUTTON_DOWN, WM_RBUTTON_DOWN, WM_LBUTTON_UP,
Jason Rumney <jasonr@gnu.org>
parents:
27516
diff
changeset
|
130 /* Switch to control whether we inhibit requests for synthesized bold |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
131 and italic versions of fonts. */ |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
132 int w32_enable_synthesized_fonts; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
133 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
134 /* Enable palette management. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
135 Lisp_Object Vw32_enable_palette; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
136 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
137 /* 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
|
138 be converted to a middle button down event. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
139 Lisp_Object Vw32_mouse_button_tolerance; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
140 |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
141 /* 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
|
142 events that are passed on to the event loop. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
143 Lisp_Object Vw32_mouse_move_interval; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
144 |
42719
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
145 /* Flag to indicate if XBUTTON events should be passed on to Windows. */ |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
146 int w32_pass_extra_mouse_buttons_to_system; |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
147 |
13434 | 148 /* The name we're using in resource queries. */ |
149 Lisp_Object Vx_resource_name; | |
150 | |
151 /* Non nil if no window manager is in use. */ | |
152 Lisp_Object Vx_no_window_manager; | |
153 | |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
154 /* Non-zero means we're allowed to display a hourglass pointer. */ |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
155 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
156 int display_hourglass_p; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
157 |
13434 | 158 /* The background and shape of the mouse pointer, and shape when not |
159 over text or in the modeline. */ | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
160 |
13434 | 161 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape; |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
162 Lisp_Object Vx_hourglass_pointer_shape, Vx_window_horizontal_drag_shape; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
163 |
13434 | 164 /* The shape when over mouse-sensitive text. */ |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
165 |
13434 | 166 Lisp_Object Vx_sensitive_text_pointer_shape; |
167 | |
168 /* Color of chars displayed in cursor box. */ | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
169 |
13434 | 170 Lisp_Object Vx_cursor_fore_pixel; |
171 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
172 /* Nonzero if using Windows. */ |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
173 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
174 static int w32_in_use; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
175 |
13434 | 176 /* Search path for bitmap files. */ |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
177 |
13434 | 178 Lisp_Object Vx_bitmap_file_path; |
179 | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
180 /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */ |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
181 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
182 Lisp_Object Vx_pixel_size_width_font_regexp; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
183 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
184 /* Alist of bdf fonts and the files that define them. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
185 Lisp_Object Vw32_bdf_filename_alist; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
186 |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
187 /* A flag to control whether fonts are matched strictly or not. */ |
24481
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
188 int w32_strict_fontnames; |
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
189 |
24695
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
190 /* A flag to control whether we should only repaint if GetUpdateRect |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
191 indicates there is an update region. */ |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
192 int w32_strict_painting; |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
193 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
194 /* Associative list linking character set strings to Windows codepages. */ |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
195 Lisp_Object Vw32_charset_info_alist; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
196 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
197 /* VIETNAMESE_CHARSET is not defined in some versions of MSVC. */ |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
198 #ifndef VIETNAMESE_CHARSET |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
199 #define VIETNAMESE_CHARSET 163 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
200 #endif |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
201 |
13434 | 202 Lisp_Object Qauto_raise; |
203 Lisp_Object Qauto_lower; | |
204 Lisp_Object Qbar; | |
205 Lisp_Object Qborder_color; | |
206 Lisp_Object Qborder_width; | |
207 Lisp_Object Qbox; | |
208 Lisp_Object Qcursor_color; | |
209 Lisp_Object Qcursor_type; | |
210 Lisp_Object Qgeometry; | |
211 Lisp_Object Qicon_left; | |
212 Lisp_Object Qicon_top; | |
213 Lisp_Object Qicon_type; | |
214 Lisp_Object Qicon_name; | |
215 Lisp_Object Qinternal_border_width; | |
216 Lisp_Object Qleft; | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
217 Lisp_Object Qright; |
13434 | 218 Lisp_Object Qmouse_color; |
219 Lisp_Object Qnone; | |
220 Lisp_Object Qparent_id; | |
221 Lisp_Object Qscroll_bar_width; | |
222 Lisp_Object Qsuppress_icon; | |
223 Lisp_Object Qundefined_color; | |
224 Lisp_Object Qvertical_scroll_bars; | |
225 Lisp_Object Qvisibility; | |
226 Lisp_Object Qwindow_id; | |
227 Lisp_Object Qx_frame_parameter; | |
228 Lisp_Object Qx_resource_name; | |
229 Lisp_Object Quser_position; | |
230 Lisp_Object Quser_size; | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
231 Lisp_Object Qscreen_gamma; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
232 Lisp_Object Qline_spacing; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
233 Lisp_Object Qcenter; |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
234 Lisp_Object Qcancel_timer; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
235 Lisp_Object Qhyper; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
236 Lisp_Object Qsuper; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
237 Lisp_Object Qmeta; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
238 Lisp_Object Qalt; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
239 Lisp_Object Qctrl; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
240 Lisp_Object Qcontrol; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
241 Lisp_Object Qshift; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
242 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
243 Lisp_Object Qw32_charset_ansi; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
244 Lisp_Object Qw32_charset_default; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
245 Lisp_Object Qw32_charset_symbol; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
246 Lisp_Object Qw32_charset_shiftjis; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
247 Lisp_Object Qw32_charset_hangeul; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
248 Lisp_Object Qw32_charset_gb2312; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
249 Lisp_Object Qw32_charset_chinesebig5; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
250 Lisp_Object Qw32_charset_oem; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
251 |
31110 | 252 #ifndef JOHAB_CHARSET |
253 #define JOHAB_CHARSET 130 | |
254 #endif | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
255 #ifdef JOHAB_CHARSET |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
256 Lisp_Object Qw32_charset_easteurope; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
257 Lisp_Object Qw32_charset_turkish; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
258 Lisp_Object Qw32_charset_baltic; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
259 Lisp_Object Qw32_charset_russian; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
260 Lisp_Object Qw32_charset_arabic; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
261 Lisp_Object Qw32_charset_greek; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
262 Lisp_Object Qw32_charset_hebrew; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
263 Lisp_Object Qw32_charset_vietnamese; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
264 Lisp_Object Qw32_charset_thai; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
265 Lisp_Object Qw32_charset_johab; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
266 Lisp_Object Qw32_charset_mac; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
267 #endif |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
268 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
269 #ifdef UNICODE_CHARSET |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
270 Lisp_Object Qw32_charset_unicode; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
271 #endif |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
272 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
273 extern Lisp_Object Qtop; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
274 extern Lisp_Object Qdisplay; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
275 extern Lisp_Object Qtool_bar_lines; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
276 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
277 /* 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
|
278 #define LMOUSE 1 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
279 #define MMOUSE 2 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
280 #define RMOUSE 4 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
281 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
282 static int button_state = 0; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
283 static W32Msg saved_mouse_button_msg; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
284 static unsigned mouse_button_timer; /* non-zero when timer is active */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
285 static W32Msg saved_mouse_move_msg; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
286 static unsigned mouse_move_timer; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
287 |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
288 /* Window that is tracking the mouse. */ |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
289 static HWND track_mouse_window; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
290 FARPROC track_mouse_event_fn; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
291 |
21874
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
292 /* W95 mousewheel handler */ |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
293 unsigned int msh_mousewheel = 0; |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
294 |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
295 #define MOUSE_BUTTON_ID 1 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
296 #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
|
297 |
13434 | 298 /* The below are defined in frame.c. */ |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
299 |
13434 | 300 extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth; |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
301 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
302 extern Lisp_Object Qtool_bar_lines; |
13434 | 303 |
304 extern Lisp_Object Vwindow_system_version; | |
305 | |
22625
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
306 Lisp_Object Qface_set_after_frame_default; |
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
307 |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
308 #ifdef GLYPH_DEBUG |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
309 int image_cache_refcount, dpyinfo_refcount; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
310 #endif |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
311 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
312 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
313 /* From w32term.c. */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
314 extern Lisp_Object Vw32_num_mouse_buttons; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
315 extern Lisp_Object Vw32_recognize_altgr; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
316 |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
317 extern HWND w32_system_caret_hwnd; |
42865
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
318 |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
319 extern int w32_system_caret_height; |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
320 extern int w32_system_caret_x; |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
321 extern int w32_system_caret_y; |
42865
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
322 extern int w32_use_visible_system_caret; |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
323 |
42918
9b06036a8c5e
(syms_of_w32fns): Initialize w32_visible_system_caret_hwnd.
Jason Rumney <jasonr@gnu.org>
parents:
42865
diff
changeset
|
324 static HWND w32_visible_system_caret_hwnd; |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
325 |
13434 | 326 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
327 /* Error if we are not connected to MS-Windows. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
328 void |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
329 check_w32 () |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
330 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
331 if (! w32_in_use) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
332 error ("MS-Windows not in use or not initialized"); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
333 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
334 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
335 /* Nonzero if we can use mouse menus. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
336 You should not call this unless HAVE_MENUS is defined. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
337 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
338 int |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
339 have_menus_p () |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
340 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
341 return w32_in_use; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
342 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
343 |
13434 | 344 /* Extract a frame as a FRAME_PTR, defaulting to the selected frame |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
345 and checking validity for W32. */ |
13434 | 346 |
347 FRAME_PTR | |
348 check_x_frame (frame) | |
349 Lisp_Object frame; | |
350 { | |
351 FRAME_PTR f; | |
352 | |
353 if (NILP (frame)) | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
354 frame = selected_frame; |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
355 CHECK_LIVE_FRAME (frame); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
356 f = XFRAME (frame); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
357 if (! FRAME_W32_P (f)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
358 error ("non-w32 frame used"); |
13434 | 359 return f; |
360 } | |
361 | |
362 /* Let the user specify an display with a frame. | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
363 nil stands for the selected frame--or, if that is not a w32 frame, |
13434 | 364 the first display on the list. */ |
365 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
366 static struct w32_display_info * |
13434 | 367 check_x_display_info (frame) |
368 Lisp_Object frame; | |
369 { | |
370 if (NILP (frame)) | |
371 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
372 struct frame *sf = XFRAME (selected_frame); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
373 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
374 if (FRAME_W32_P (sf) && FRAME_LIVE_P (sf)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
375 return FRAME_W32_DISPLAY_INFO (sf); |
13434 | 376 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
377 return &one_w32_display_info; |
13434 | 378 } |
379 else if (STRINGP (frame)) | |
380 return x_display_info_for_name (frame); | |
381 else | |
382 { | |
383 FRAME_PTR f; | |
384 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
385 CHECK_LIVE_FRAME (frame); |
13434 | 386 f = XFRAME (frame); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
387 if (! FRAME_W32_P (f)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
388 error ("non-w32 frame used"); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
389 return FRAME_W32_DISPLAY_INFO (f); |
13434 | 390 } |
391 } | |
392 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
393 /* Return the Emacs frame-object corresponding to an w32 window. |
13434 | 394 It could be the frame's main window or an icon window. */ |
395 | |
396 /* This function can be called during GC, so use GC_xxx type test macros. */ | |
397 | |
398 struct frame * | |
399 x_window_to_frame (dpyinfo, wdesc) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
400 struct w32_display_info *dpyinfo; |
13434 | 401 HWND wdesc; |
402 { | |
403 Lisp_Object tail, frame; | |
404 struct frame *f; | |
405 | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
406 for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail)) |
13434 | 407 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
408 frame = XCAR (tail); |
13434 | 409 if (!GC_FRAMEP (frame)) |
410 continue; | |
411 f = XFRAME (frame); | |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
25646
diff
changeset
|
412 if (!FRAME_W32_P (f) || FRAME_W32_DISPLAY_INFO (f) != dpyinfo) |
13434 | 413 continue; |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
414 if (f->output_data.w32->hourglass_window == wdesc) |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
415 return f; |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
416 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
417 if (FRAME_W32_WINDOW (f) == wdesc) |
13434 | 418 return f; |
419 } | |
420 return 0; | |
421 } | |
422 | |
423 | |
424 | |
425 /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap | |
426 id, which is just an int that this section returns. Bitmaps are | |
427 reference counted so they can be shared among frames. | |
428 | |
429 Bitmap indices are guaranteed to be > 0, so a negative number can | |
430 be used to indicate no bitmap. | |
431 | |
432 If you use x_create_bitmap_from_data, then you must keep track of | |
433 the bitmaps yourself. That is, creating a bitmap from the same | |
434 data more than once will not be caught. */ | |
435 | |
436 | |
437 /* Functions to access the contents of a bitmap, given an id. */ | |
438 | |
439 int | |
440 x_bitmap_height (f, id) | |
441 FRAME_PTR f; | |
442 int id; | |
443 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
444 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].height; |
13434 | 445 } |
446 | |
447 int | |
448 x_bitmap_width (f, id) | |
449 FRAME_PTR f; | |
450 int id; | |
451 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
452 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].width; |
13434 | 453 } |
454 | |
455 int | |
456 x_bitmap_pixmap (f, id) | |
457 FRAME_PTR f; | |
458 int id; | |
459 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
460 return (int) FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; |
13434 | 461 } |
462 | |
463 | |
464 /* Allocate a new bitmap record. Returns index of new record. */ | |
465 | |
466 static int | |
467 x_allocate_bitmap_record (f) | |
468 FRAME_PTR f; | |
469 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
470 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 471 int i; |
472 | |
473 if (dpyinfo->bitmaps == NULL) | |
474 { | |
475 dpyinfo->bitmaps_size = 10; | |
476 dpyinfo->bitmaps | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
477 = (struct w32_bitmap_record *) xmalloc (dpyinfo->bitmaps_size * sizeof (struct w32_bitmap_record)); |
13434 | 478 dpyinfo->bitmaps_last = 1; |
479 return 1; | |
480 } | |
481 | |
482 if (dpyinfo->bitmaps_last < dpyinfo->bitmaps_size) | |
483 return ++dpyinfo->bitmaps_last; | |
484 | |
485 for (i = 0; i < dpyinfo->bitmaps_size; ++i) | |
486 if (dpyinfo->bitmaps[i].refcount == 0) | |
487 return i + 1; | |
488 | |
489 dpyinfo->bitmaps_size *= 2; | |
490 dpyinfo->bitmaps | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
491 = (struct w32_bitmap_record *) xrealloc (dpyinfo->bitmaps, |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
492 dpyinfo->bitmaps_size * sizeof (struct w32_bitmap_record)); |
13434 | 493 return ++dpyinfo->bitmaps_last; |
494 } | |
495 | |
496 /* Add one reference to the reference count of the bitmap with id ID. */ | |
497 | |
498 void | |
499 x_reference_bitmap (f, id) | |
500 FRAME_PTR f; | |
501 int id; | |
502 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
503 ++FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].refcount; |
13434 | 504 } |
505 | |
506 /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */ | |
507 | |
508 int | |
509 x_create_bitmap_from_data (f, bits, width, height) | |
510 struct frame *f; | |
511 char *bits; | |
512 unsigned int width, height; | |
513 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
514 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 515 Pixmap bitmap; |
516 int id; | |
517 | |
518 bitmap = CreateBitmap (width, height, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
519 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_planes, |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
520 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_cbits, |
13434 | 521 bits); |
522 | |
523 if (! bitmap) | |
524 return -1; | |
525 | |
526 id = x_allocate_bitmap_record (f); | |
527 dpyinfo->bitmaps[id - 1].pixmap = bitmap; | |
528 dpyinfo->bitmaps[id - 1].file = NULL; | |
529 dpyinfo->bitmaps[id - 1].hinst = NULL; | |
530 dpyinfo->bitmaps[id - 1].refcount = 1; | |
531 dpyinfo->bitmaps[id - 1].depth = 1; | |
532 dpyinfo->bitmaps[id - 1].height = height; | |
533 dpyinfo->bitmaps[id - 1].width = width; | |
534 | |
535 return id; | |
536 } | |
537 | |
538 /* Create bitmap from file FILE for frame F. */ | |
539 | |
540 int | |
541 x_create_bitmap_from_file (f, file) | |
542 struct frame *f; | |
543 Lisp_Object file; | |
544 { | |
545 return -1; | |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
546 #if 0 /* TODO : bitmap support */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
547 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 548 unsigned int width, height; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
549 HBITMAP bitmap; |
13434 | 550 int xhot, yhot, result, id; |
551 Lisp_Object found; | |
552 int fd; | |
553 char *filename; | |
554 HINSTANCE hinst; | |
555 | |
556 /* Look for an existing bitmap with the same name. */ | |
557 for (id = 0; id < dpyinfo->bitmaps_last; ++id) | |
558 { | |
559 if (dpyinfo->bitmaps[id].refcount | |
560 && dpyinfo->bitmaps[id].file | |
561 && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data)) | |
562 { | |
563 ++dpyinfo->bitmaps[id].refcount; | |
564 return id + 1; | |
565 } | |
566 } | |
567 | |
568 /* Search bitmap-file-path for the file, if appropriate. */ | |
39812
66e0816837a8
Update calls to openp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39548
diff
changeset
|
569 fd = openp (Vx_bitmap_file_path, file, Qnil, &found, 0); |
13434 | 570 if (fd < 0) |
571 return -1; | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
572 emacs_close (fd); |
13434 | 573 |
574 filename = (char *) XSTRING (found)->data; | |
575 | |
576 hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE); | |
577 | |
578 if (hinst == NULL) | |
579 return -1; | |
580 | |
581 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
582 result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), |
13434 | 583 filename, &width, &height, &bitmap, &xhot, &yhot); |
584 if (result != BitmapSuccess) | |
585 return -1; | |
586 | |
587 id = x_allocate_bitmap_record (f); | |
588 dpyinfo->bitmaps[id - 1].pixmap = bitmap; | |
589 dpyinfo->bitmaps[id - 1].refcount = 1; | |
590 dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1); | |
591 dpyinfo->bitmaps[id - 1].depth = 1; | |
592 dpyinfo->bitmaps[id - 1].height = height; | |
593 dpyinfo->bitmaps[id - 1].width = width; | |
594 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data); | |
595 | |
596 return id; | |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
597 #endif /* TODO */ |
13434 | 598 } |
599 | |
600 /* Remove reference to bitmap with id number ID. */ | |
601 | |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
602 void |
13434 | 603 x_destroy_bitmap (f, id) |
604 FRAME_PTR f; | |
605 int id; | |
606 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
607 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 608 |
609 if (id > 0) | |
610 { | |
611 --dpyinfo->bitmaps[id - 1].refcount; | |
612 if (dpyinfo->bitmaps[id - 1].refcount == 0) | |
613 { | |
614 BLOCK_INPUT; | |
615 DeleteObject (dpyinfo->bitmaps[id - 1].pixmap); | |
616 if (dpyinfo->bitmaps[id - 1].file) | |
617 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
618 xfree (dpyinfo->bitmaps[id - 1].file); |
13434 | 619 dpyinfo->bitmaps[id - 1].file = NULL; |
620 } | |
621 UNBLOCK_INPUT; | |
622 } | |
623 } | |
624 } | |
625 | |
626 /* Free all the bitmaps for the display specified by DPYINFO. */ | |
627 | |
628 static void | |
629 x_destroy_all_bitmaps (dpyinfo) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
630 struct w32_display_info *dpyinfo; |
13434 | 631 { |
632 int i; | |
633 for (i = 0; i < dpyinfo->bitmaps_last; i++) | |
634 if (dpyinfo->bitmaps[i].refcount > 0) | |
635 { | |
636 DeleteObject (dpyinfo->bitmaps[i].pixmap); | |
637 if (dpyinfo->bitmaps[i].file) | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
638 xfree (dpyinfo->bitmaps[i].file); |
13434 | 639 } |
640 dpyinfo->bitmaps_last = 0; | |
641 } | |
642 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
643 /* Connect the frame-parameter names for W32 frames |
13434 | 644 to the ways of passing the parameter values to the window system. |
645 | |
646 The name of a parameter, as a Lisp symbol, | |
647 has an `x-frame-parameter' property which is an integer in Lisp | |
648 but can be interpreted as an `enum x_frame_parm' in C. */ | |
649 | |
650 enum x_frame_parm | |
651 { | |
652 X_PARM_FOREGROUND_COLOR, | |
653 X_PARM_BACKGROUND_COLOR, | |
654 X_PARM_MOUSE_COLOR, | |
655 X_PARM_CURSOR_COLOR, | |
656 X_PARM_BORDER_COLOR, | |
657 X_PARM_ICON_TYPE, | |
658 X_PARM_FONT, | |
659 X_PARM_BORDER_WIDTH, | |
660 X_PARM_INTERNAL_BORDER_WIDTH, | |
661 X_PARM_NAME, | |
662 X_PARM_AUTORAISE, | |
663 X_PARM_AUTOLOWER, | |
664 X_PARM_VERT_SCROLL_BAR, | |
665 X_PARM_VISIBILITY, | |
666 X_PARM_MENU_BAR_LINES | |
667 }; | |
668 | |
669 | |
670 struct x_frame_parm_table | |
671 { | |
672 char *name; | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
673 void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
13434 | 674 }; |
675 | |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
676 BOOL my_show_window P_ ((struct frame *, HWND, int)); |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
677 void my_set_window_pos P_ ((HWND, HWND, int, int, int, int, UINT)); |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
678 static Lisp_Object unwind_create_frame P_ ((Lisp_Object)); |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
679 static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object)); |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
680 static void x_change_window_heights P_ ((Lisp_Object, int)); |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
681 /* TODO: Native Input Method support; see x_create_im. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
682 void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
683 static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
684 void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
685 void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
686 void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
687 void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
688 void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
689 void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
690 void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
691 void x_set_font P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
41726
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
692 static void x_set_fringe_width P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
693 void x_set_border_width P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
694 void x_set_internal_border_width P_ ((struct frame *, Lisp_Object, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
695 Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
696 void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
697 void x_set_autoraise P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
698 void x_set_autolower P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
699 void x_set_vertical_scroll_bars P_ ((struct frame *, Lisp_Object, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
700 Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
701 void x_set_visibility P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
702 void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
703 void x_set_scroll_bar_width P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
704 void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
705 void x_set_unsplittable P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
706 void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
707 static void x_set_screen_gamma P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
708 static void x_edge_detection P_ ((struct frame *, struct image *, Lisp_Object, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
709 Lisp_Object)); |
13434 | 710 |
711 static struct x_frame_parm_table x_frame_parms[] = | |
712 { | |
42537
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
713 {"auto-raise", x_set_autoraise}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
714 {"auto-lower", x_set_autolower}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
715 {"background-color", x_set_background_color}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
716 {"border-color", x_set_border_color}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
717 {"border-width", x_set_border_width}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
718 {"cursor-color", x_set_cursor_color}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
719 {"cursor-type", x_set_cursor_type}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
720 {"font", x_set_font}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
721 {"foreground-color", x_set_foreground_color}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
722 {"icon-name", x_set_icon_name}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
723 {"icon-type", x_set_icon_type}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
724 {"internal-border-width", x_set_internal_border_width}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
725 {"menu-bar-lines", x_set_menu_bar_lines}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
726 {"mouse-color", x_set_mouse_color}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
727 {"name", x_explicitly_set_name}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
728 {"scroll-bar-width", x_set_scroll_bar_width}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
729 {"title", x_set_title}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
730 {"unsplittable", x_set_unsplittable}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
731 {"vertical-scroll-bars", x_set_vertical_scroll_bars}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
732 {"visibility", x_set_visibility}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
733 {"tool-bar-lines", x_set_tool_bar_lines}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
734 {"screen-gamma", x_set_screen_gamma}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
735 {"line-spacing", x_set_line_spacing}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
736 {"left-fringe", x_set_fringe_width}, |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
737 {"right-fringe", x_set_fringe_width} |
13434 | 738 }; |
739 | |
740 /* Attach the `x-frame-parameter' properties to | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
741 the Lisp symbol names of parameters relevant to W32. */ |
13434 | 742 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
743 void |
13434 | 744 init_x_parm_symbols () |
745 { | |
746 int i; | |
747 | |
748 for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++) | |
749 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter, | |
750 make_number (i)); | |
751 } | |
752 | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
753 /* Change the parameters of frame F as specified by ALIST. |
13434 | 754 If a parameter is not specially recognized, do nothing; |
755 otherwise call the `x_set_...' function for that parameter. */ | |
756 | |
757 void | |
758 x_set_frame_parameters (f, alist) | |
759 FRAME_PTR f; | |
760 Lisp_Object alist; | |
761 { | |
762 Lisp_Object tail; | |
763 | |
764 /* If both of these parameters are present, it's more efficient to | |
765 set them both at once. So we wait until we've looked at the | |
766 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
|
767 int width, height; |
13434 | 768 |
769 /* Same here. */ | |
770 Lisp_Object left, top; | |
771 | |
772 /* Same with these. */ | |
773 Lisp_Object icon_left, icon_top; | |
774 | |
775 /* Record in these vectors all the parms specified. */ | |
776 Lisp_Object *parms; | |
777 Lisp_Object *values; | |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
778 int i, p; |
13434 | 779 int left_no_change = 0, top_no_change = 0; |
780 int icon_left_no_change = 0, icon_top_no_change = 0; | |
781 | |
24211
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
782 struct gcpro gcpro1, gcpro2; |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
783 |
13434 | 784 i = 0; |
785 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | |
786 i++; | |
787 | |
788 parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); | |
789 values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); | |
790 | |
791 /* Extract parm names and values into those vectors. */ | |
792 | |
793 i = 0; | |
794 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | |
795 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
796 Lisp_Object elt; |
13434 | 797 |
798 elt = Fcar (tail); | |
799 parms[i] = Fcar (elt); | |
800 values[i] = Fcdr (elt); | |
801 i++; | |
802 } | |
24211
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
803 /* TAIL and ALIST are not used again below here. */ |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
804 alist = tail = Qnil; |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
805 |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
806 GCPRO2 (*parms, *values); |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
807 gcpro1.nvars = i; |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
808 gcpro2.nvars = i; |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
809 |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
810 /* There is no need to gcpro LEFT, TOP, ICON_LEFT, or ICON_TOP, |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
811 because their values appear in VALUES and strings are not valid. */ |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
812 top = left = Qunbound; |
13434 | 813 icon_left = icon_top = Qunbound; |
814 | |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
815 /* Provide default values for HEIGHT and WIDTH. */ |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
816 if (FRAME_NEW_WIDTH (f)) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
817 width = FRAME_NEW_WIDTH (f); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
818 else |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
819 width = FRAME_WIDTH (f); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
820 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
821 if (FRAME_NEW_HEIGHT (f)) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
822 height = FRAME_NEW_HEIGHT (f); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
823 else |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
824 height = FRAME_HEIGHT (f); |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
825 |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
826 /* Process foreground_color and background_color before anything else. |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
827 They are independent of other properties, but other properties (e.g., |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
828 cursor_color) are dependent upon them. */ |
41726
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
829 /* Process default font as well, since fringe widths depends on it. */ |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
830 for (p = 0; p < i; p++) |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
831 { |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
832 Lisp_Object prop, val; |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
833 |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
834 prop = parms[p]; |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
835 val = values[p]; |
41726
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
836 if (EQ (prop, Qforeground_color) |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
837 || EQ (prop, Qbackground_color) |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
838 || EQ (prop, Qfont)) |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
839 { |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
840 register Lisp_Object param_index, old_value; |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
841 |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
842 old_value = get_frame_param (f, prop); |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
843 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
844 if (NILP (Fequal (val, old_value))) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
845 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
846 store_frame_param (f, prop, val); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
847 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
848 param_index = Fget (prop, Qx_frame_parameter); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
849 if (NATNUMP (param_index) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
850 && (XFASTINT (param_index) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
851 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]))) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
852 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
853 } |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
854 } |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
855 } |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
856 |
13434 | 857 /* Now process them in reverse of specified order. */ |
858 for (i--; i >= 0; i--) | |
859 { | |
860 Lisp_Object prop, val; | |
861 | |
862 prop = parms[i]; | |
863 val = values[i]; | |
864 | |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
865 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
|
866 width = XFASTINT (val); |
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
867 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
|
868 height = XFASTINT (val); |
13434 | 869 else if (EQ (prop, Qtop)) |
870 top = val; | |
871 else if (EQ (prop, Qleft)) | |
872 left = val; | |
873 else if (EQ (prop, Qicon_top)) | |
874 icon_top = val; | |
875 else if (EQ (prop, Qicon_left)) | |
876 icon_left = val; | |
41726
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
877 else if (EQ (prop, Qforeground_color) |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
878 || EQ (prop, Qbackground_color) |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
879 || EQ (prop, Qfont)) |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
880 /* Processed above. */ |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
881 continue; |
13434 | 882 else |
883 { | |
884 register Lisp_Object param_index, old_value; | |
885 | |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
886 old_value = get_frame_param (f, prop); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
887 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
888 store_frame_param (f, prop, val); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
889 |
13434 | 890 param_index = Fget (prop, Qx_frame_parameter); |
891 if (NATNUMP (param_index) | |
892 && (XFASTINT (param_index) | |
893 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]))) | |
14353 | 894 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value); |
13434 | 895 } |
896 } | |
897 | |
898 /* Don't die if just one of these was set. */ | |
899 if (EQ (left, Qunbound)) | |
900 { | |
901 left_no_change = 1; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
902 if (f->output_data.w32->left_pos < 0) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
903 left = Fcons (Qplus, Fcons (make_number (f->output_data.w32->left_pos), Qnil)); |
13434 | 904 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
905 XSETINT (left, f->output_data.w32->left_pos); |
13434 | 906 } |
907 if (EQ (top, Qunbound)) | |
908 { | |
909 top_no_change = 1; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
910 if (f->output_data.w32->top_pos < 0) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
911 top = Fcons (Qplus, Fcons (make_number (f->output_data.w32->top_pos), Qnil)); |
13434 | 912 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
913 XSETINT (top, f->output_data.w32->top_pos); |
13434 | 914 } |
915 | |
916 /* If one of the icon positions was not set, preserve or default it. */ | |
917 if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left)) | |
918 { | |
919 icon_left_no_change = 1; | |
920 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist)); | |
921 if (NILP (icon_left)) | |
922 XSETINT (icon_left, 0); | |
923 } | |
924 if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top)) | |
925 { | |
926 icon_top_no_change = 1; | |
927 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist)); | |
928 if (NILP (icon_top)) | |
929 XSETINT (icon_top, 0); | |
930 } | |
931 | |
932 /* Don't set these parameters unless they've been explicitly | |
933 specified. The window might be mapped or resized while we're in | |
934 this function, and we don't want to override that unless the lisp | |
935 code has asked for it. | |
936 | |
937 Don't set these parameters unless they actually differ from the | |
938 window's current parameters; the window may not actually exist | |
939 yet. */ | |
940 { | |
941 Lisp_Object frame; | |
942 | |
943 check_frame_size (f, &height, &width); | |
944 | |
945 XSETFRAME (frame, f); | |
946 | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
947 if (width != FRAME_WIDTH (f) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
948 || height != FRAME_HEIGHT (f) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
949 || FRAME_NEW_HEIGHT (f) || FRAME_NEW_WIDTH (f)) |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
950 Fset_frame_size (frame, make_number (width), make_number (height)); |
13434 | 951 |
952 if ((!NILP (left) || !NILP (top)) | |
953 && ! (left_no_change && top_no_change) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
954 && ! (NUMBERP (left) && XINT (left) == f->output_data.w32->left_pos |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
955 && NUMBERP (top) && XINT (top) == f->output_data.w32->top_pos)) |
13434 | 956 { |
957 int leftpos = 0; | |
958 int toppos = 0; | |
959 | |
960 /* Record the signs. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
961 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative); |
13434 | 962 if (EQ (left, Qminus)) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
963 f->output_data.w32->size_hint_flags |= XNegative; |
13434 | 964 else if (INTEGERP (left)) |
965 { | |
966 leftpos = XINT (left); | |
967 if (leftpos < 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
968 f->output_data.w32->size_hint_flags |= XNegative; |
13434 | 969 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
970 else if (CONSP (left) && EQ (XCAR (left), Qminus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
971 && CONSP (XCDR (left)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
972 && INTEGERP (XCAR (XCDR (left)))) |
13434 | 973 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
974 leftpos = - XINT (XCAR (XCDR (left))); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
975 f->output_data.w32->size_hint_flags |= XNegative; |
13434 | 976 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
977 else if (CONSP (left) && EQ (XCAR (left), Qplus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
978 && CONSP (XCDR (left)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
979 && INTEGERP (XCAR (XCDR (left)))) |
13434 | 980 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
981 leftpos = XINT (XCAR (XCDR (left))); |
13434 | 982 } |
983 | |
984 if (EQ (top, Qminus)) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
985 f->output_data.w32->size_hint_flags |= YNegative; |
13434 | 986 else if (INTEGERP (top)) |
987 { | |
988 toppos = XINT (top); | |
989 if (toppos < 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
990 f->output_data.w32->size_hint_flags |= YNegative; |
13434 | 991 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
992 else if (CONSP (top) && EQ (XCAR (top), Qminus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
993 && CONSP (XCDR (top)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
994 && INTEGERP (XCAR (XCDR (top)))) |
13434 | 995 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
996 toppos = - XINT (XCAR (XCDR (top))); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
997 f->output_data.w32->size_hint_flags |= YNegative; |
13434 | 998 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
999 else if (CONSP (top) && EQ (XCAR (top), Qplus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1000 && CONSP (XCDR (top)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1001 && INTEGERP (XCAR (XCDR (top)))) |
13434 | 1002 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1003 toppos = XINT (XCAR (XCDR (top))); |
13434 | 1004 } |
1005 | |
1006 | |
1007 /* Store the numeric value of the position. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1008 f->output_data.w32->top_pos = toppos; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1009 f->output_data.w32->left_pos = leftpos; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1010 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1011 f->output_data.w32->win_gravity = NorthWestGravity; |
13434 | 1012 |
1013 /* Actually set that position, and convert to absolute. */ | |
1014 x_set_offset (f, leftpos, toppos, -1); | |
1015 } | |
1016 | |
1017 if ((!NILP (icon_left) || !NILP (icon_top)) | |
1018 && ! (icon_left_no_change && icon_top_no_change)) | |
1019 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top)); | |
1020 } | |
24211
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
1021 |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
1022 UNGCPRO; |
13434 | 1023 } |
1024 | |
1025 /* Store the screen positions of frame F into XPTR and YPTR. | |
1026 These are the positions of the containing window manager window, | |
1027 not Emacs's own window. */ | |
1028 | |
1029 void | |
1030 x_real_positions (f, xptr, yptr) | |
1031 FRAME_PTR f; | |
1032 int *xptr, *yptr; | |
1033 { | |
1034 POINT pt; | |
14353 | 1035 |
1036 { | |
1037 RECT rect; | |
13434 | 1038 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1039 GetClientRect(FRAME_W32_WINDOW(f), &rect); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1040 AdjustWindowRect(&rect, f->output_data.w32->dwStyle, FRAME_EXTERNAL_MENU_BAR(f)); |
13434 | 1041 |
14353 | 1042 pt.x = rect.left; |
1043 pt.y = rect.top; | |
1044 } | |
1045 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1046 ClientToScreen (FRAME_W32_WINDOW(f), &pt); |
13434 | 1047 |
1048 *xptr = pt.x; | |
1049 *yptr = pt.y; | |
1050 } | |
1051 | |
1052 /* Insert a description of internally-recorded parameters of frame X | |
1053 into the parameter alist *ALISTPTR that is to be given to the user. | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1054 Only parameters that are specific to W32 |
13434 | 1055 and whose values are not correctly recorded in the frame's |
1056 param_alist need to be considered here. */ | |
1057 | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1058 void |
13434 | 1059 x_report_frame_params (f, alistptr) |
1060 struct frame *f; | |
1061 Lisp_Object *alistptr; | |
1062 { | |
1063 char buf[16]; | |
1064 Lisp_Object tem; | |
1065 | |
1066 /* Represent negative positions (off the top or left screen edge) | |
1067 in a way that Fmodify_frame_parameters will understand correctly. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1068 XSETINT (tem, f->output_data.w32->left_pos); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1069 if (f->output_data.w32->left_pos >= 0) |
13434 | 1070 store_in_alist (alistptr, Qleft, tem); |
1071 else | |
1072 store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil))); | |
1073 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1074 XSETINT (tem, f->output_data.w32->top_pos); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1075 if (f->output_data.w32->top_pos >= 0) |
13434 | 1076 store_in_alist (alistptr, Qtop, tem); |
1077 else | |
1078 store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil))); | |
1079 | |
1080 store_in_alist (alistptr, Qborder_width, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1081 make_number (f->output_data.w32->border_width)); |
13434 | 1082 store_in_alist (alistptr, Qinternal_border_width, |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1083 make_number (f->output_data.w32->internal_border_width)); |
41834
efe03af8f775
(x_report_frame_params): Return actual fringe widths.
Kim F. Storm <storm@cua.dk>
parents:
41732
diff
changeset
|
1084 store_in_alist (alistptr, Qleft_fringe, |
efe03af8f775
(x_report_frame_params): Return actual fringe widths.
Kim F. Storm <storm@cua.dk>
parents:
41732
diff
changeset
|
1085 make_number (f->output_data.w32->left_fringe_width)); |
efe03af8f775
(x_report_frame_params): Return actual fringe widths.
Kim F. Storm <storm@cua.dk>
parents:
41732
diff
changeset
|
1086 store_in_alist (alistptr, Qright_fringe, |
efe03af8f775
(x_report_frame_params): Return actual fringe widths.
Kim F. Storm <storm@cua.dk>
parents:
41732
diff
changeset
|
1087 make_number (f->output_data.w32->right_fringe_width)); |
42007
81966d7ace84
(x_report_frame_params): Makes the scroll-bar-width frame parameter have
Eli Zaretskii <eliz@gnu.org>
parents:
41834
diff
changeset
|
1088 store_in_alist (alistptr, Qscroll_bar_width, |
81966d7ace84
(x_report_frame_params): Makes the scroll-bar-width frame parameter have
Eli Zaretskii <eliz@gnu.org>
parents:
41834
diff
changeset
|
1089 make_number (FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
81966d7ace84
(x_report_frame_params): Makes the scroll-bar-width frame parameter have
Eli Zaretskii <eliz@gnu.org>
parents:
41834
diff
changeset
|
1090 ? FRAME_SCROLL_BAR_PIXEL_WIDTH(f) |
81966d7ace84
(x_report_frame_params): Makes the scroll-bar-width frame parameter have
Eli Zaretskii <eliz@gnu.org>
parents:
41834
diff
changeset
|
1091 : 0)); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1092 sprintf (buf, "%ld", (long) FRAME_W32_WINDOW (f)); |
13434 | 1093 store_in_alist (alistptr, Qwindow_id, |
1094 build_string (buf)); | |
1095 store_in_alist (alistptr, Qicon_name, f->icon_name); | |
1096 FRAME_SAMPLE_VISIBILITY (f); | |
1097 store_in_alist (alistptr, Qvisibility, | |
1098 (FRAME_VISIBLE_P (f) ? Qt | |
1099 : FRAME_ICONIFIED_P (f) ? Qicon : Qnil)); | |
1100 store_in_alist (alistptr, Qdisplay, | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1101 XCAR (FRAME_W32_DISPLAY_INFO (f)->name_list_element)); |
13434 | 1102 } |
1103 | |
1104 | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1105 DEFUN ("w32-define-rgb-color", Fw32_define_rgb_color, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1106 Sw32_define_rgb_color, 4, 4, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1107 doc: /* Convert RGB numbers to a windows color reference and associate with NAME. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1108 This adds or updates a named color to w32-color-map, making it |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1109 available for use. The original entry's RGB ref is returned, or nil |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1110 if the entry is new. */) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1111 (red, green, blue, name) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1112 Lisp_Object red, green, blue, name; |
13434 | 1113 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1114 Lisp_Object rgb; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1115 Lisp_Object oldrgb = Qnil; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1116 Lisp_Object entry; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1117 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
1118 CHECK_NUMBER (red); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
1119 CHECK_NUMBER (green); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
1120 CHECK_NUMBER (blue); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
1121 CHECK_STRING (name); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1122 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1123 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
|
1124 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1125 BLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1126 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1127 /* replace existing entry in w32-color-map or add new entry. */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1128 entry = Fassoc (name, Vw32_color_map); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1129 if (NILP (entry)) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1130 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1131 entry = Fcons (name, rgb); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1132 Vw32_color_map = Fcons (entry, Vw32_color_map); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1133 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1134 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1135 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1136 oldrgb = Fcdr (entry); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1137 Fsetcdr (entry, rgb); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1138 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1139 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1140 UNBLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1141 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1142 return (oldrgb); |
13434 | 1143 } |
1144 | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1145 DEFUN ("w32-load-color-file", Fw32_load_color_file, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1146 Sw32_load_color_file, 1, 1, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1147 doc: /* Create an alist of color entries from an external file. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1148 Assign this value to w32-color-map to replace the existing color map. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1149 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1150 The file should define one named RGB color per line like so: |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1151 R G B name |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1152 where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1153 (filename) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1154 Lisp_Object filename; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1155 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1156 FILE *fp; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1157 Lisp_Object cmap = Qnil; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1158 Lisp_Object abspath; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1159 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
1160 CHECK_STRING (filename); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1161 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
|
1162 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1163 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
|
1164 if (fp) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1165 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1166 char buf[512]; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1167 int red, green, blue; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1168 int num; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1169 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1170 BLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1171 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1172 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
|
1173 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
|
1174 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1175 char *name = buf + num; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1176 num = strlen (name) - 1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1177 if (name[num] == '\n') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1178 name[num] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1179 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
|
1180 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
|
1181 cmap); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1182 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1183 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1184 fclose (fp); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1185 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1186 UNBLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1187 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1188 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1189 return cmap; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1190 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1191 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1192 /* The default colors for the w32 color map */ |
13434 | 1193 typedef struct colormap_t |
1194 { | |
1195 char *name; | |
1196 COLORREF colorref; | |
1197 } colormap_t; | |
1198 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1199 colormap_t w32_color_map[] = |
13434 | 1200 { |
14983
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1201 {"snow" , PALETTERGB (255,250,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1202 {"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
|
1203 {"GhostWhite" , PALETTERGB (248,248,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1204 {"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
|
1205 {"WhiteSmoke" , PALETTERGB (245,245,245)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1206 {"gainsboro" , PALETTERGB (220,220,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1207 {"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
|
1208 {"FloralWhite" , PALETTERGB (255,250,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1209 {"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
|
1210 {"OldLace" , PALETTERGB (253,245,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1211 {"linen" , PALETTERGB (250,240,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1212 {"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
|
1213 {"AntiqueWhite" , PALETTERGB (250,235,215)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1214 {"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
|
1215 {"PapayaWhip" , PALETTERGB (255,239,213)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1216 {"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
|
1217 {"BlanchedAlmond" , PALETTERGB (255,235,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1218 {"bisque" , PALETTERGB (255,228,196)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1219 {"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
|
1220 {"PeachPuff" , PALETTERGB (255,218,185)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1221 {"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
|
1222 {"NavajoWhite" , PALETTERGB (255,222,173)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1223 {"moccasin" , PALETTERGB (255,228,181)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1224 {"cornsilk" , PALETTERGB (255,248,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1225 {"ivory" , PALETTERGB (255,255,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1226 {"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
|
1227 {"LemonChiffon" , PALETTERGB (255,250,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1228 {"seashell" , PALETTERGB (255,245,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1229 {"honeydew" , PALETTERGB (240,255,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1230 {"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
|
1231 {"MintCream" , PALETTERGB (245,255,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1232 {"azure" , PALETTERGB (240,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1233 {"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
|
1234 {"AliceBlue" , PALETTERGB (240,248,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1235 {"lavender" , PALETTERGB (230,230,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1236 {"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
|
1237 {"LavenderBlush" , PALETTERGB (255,240,245)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1238 {"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
|
1239 {"MistyRose" , PALETTERGB (255,228,225)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1240 {"white" , PALETTERGB (255,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1241 {"black" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1242 {"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
|
1243 {"DarkSlateGray" , PALETTERGB ( 47, 79, 79)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1244 {"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
|
1245 {"DarkSlateGrey" , PALETTERGB ( 47, 79, 79)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1246 {"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
|
1247 {"DimGray" , PALETTERGB (105,105,105)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1248 {"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
|
1249 {"DimGrey" , PALETTERGB (105,105,105)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1250 {"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
|
1251 {"SlateGray" , PALETTERGB (112,128,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1252 {"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
|
1253 {"SlateGrey" , PALETTERGB (112,128,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1254 {"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
|
1255 {"LightSlateGray" , PALETTERGB (119,136,153)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1256 {"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
|
1257 {"LightSlateGrey" , PALETTERGB (119,136,153)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1258 {"gray" , PALETTERGB (190,190,190)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1259 {"grey" , PALETTERGB (190,190,190)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1260 {"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
|
1261 {"LightGrey" , PALETTERGB (211,211,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1262 {"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
|
1263 {"LightGray" , PALETTERGB (211,211,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1264 {"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
|
1265 {"MidnightBlue" , PALETTERGB ( 25, 25,112)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1266 {"navy" , PALETTERGB ( 0, 0,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1267 {"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
|
1268 {"NavyBlue" , PALETTERGB ( 0, 0,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1269 {"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
|
1270 {"CornflowerBlue" , PALETTERGB (100,149,237)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1271 {"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
|
1272 {"DarkSlateBlue" , PALETTERGB ( 72, 61,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1273 {"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
|
1274 {"SlateBlue" , PALETTERGB (106, 90,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1275 {"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
|
1276 {"MediumSlateBlue" , PALETTERGB (123,104,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1277 {"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
|
1278 {"LightSlateBlue" , PALETTERGB (132,112,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1279 {"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
|
1280 {"MediumBlue" , PALETTERGB ( 0, 0,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1281 {"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
|
1282 {"RoyalBlue" , PALETTERGB ( 65,105,225)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1283 {"blue" , PALETTERGB ( 0, 0,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1284 {"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
|
1285 {"DodgerBlue" , PALETTERGB ( 30,144,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1286 {"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
|
1287 {"DeepSkyBlue" , PALETTERGB ( 0,191,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1288 {"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
|
1289 {"SkyBlue" , PALETTERGB (135,206,235)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1290 {"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
|
1291 {"LightSkyBlue" , PALETTERGB (135,206,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1292 {"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
|
1293 {"SteelBlue" , PALETTERGB ( 70,130,180)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1294 {"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
|
1295 {"LightSteelBlue" , PALETTERGB (176,196,222)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1296 {"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
|
1297 {"LightBlue" , PALETTERGB (173,216,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1298 {"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
|
1299 {"PowderBlue" , PALETTERGB (176,224,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1300 {"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
|
1301 {"PaleTurquoise" , PALETTERGB (175,238,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1302 {"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
|
1303 {"DarkTurquoise" , PALETTERGB ( 0,206,209)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1304 {"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
|
1305 {"MediumTurquoise" , PALETTERGB ( 72,209,204)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1306 {"turquoise" , PALETTERGB ( 64,224,208)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1307 {"cyan" , PALETTERGB ( 0,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1308 {"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
|
1309 {"LightCyan" , PALETTERGB (224,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1310 {"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
|
1311 {"CadetBlue" , PALETTERGB ( 95,158,160)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1312 {"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
|
1313 {"MediumAquamarine" , PALETTERGB (102,205,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1314 {"aquamarine" , PALETTERGB (127,255,212)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1315 {"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
|
1316 {"DarkGreen" , PALETTERGB ( 0,100, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1317 {"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
|
1318 {"DarkOliveGreen" , PALETTERGB ( 85,107, 47)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1319 {"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
|
1320 {"DarkSeaGreen" , PALETTERGB (143,188,143)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1321 {"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
|
1322 {"SeaGreen" , PALETTERGB ( 46,139, 87)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1323 {"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
|
1324 {"MediumSeaGreen" , PALETTERGB ( 60,179,113)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1325 {"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
|
1326 {"LightSeaGreen" , PALETTERGB ( 32,178,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1327 {"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
|
1328 {"PaleGreen" , PALETTERGB (152,251,152)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1329 {"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
|
1330 {"SpringGreen" , PALETTERGB ( 0,255,127)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1331 {"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
|
1332 {"LawnGreen" , PALETTERGB (124,252, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1333 {"green" , PALETTERGB ( 0,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1334 {"chartreuse" , PALETTERGB (127,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1335 {"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
|
1336 {"MediumSpringGreen" , PALETTERGB ( 0,250,154)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1337 {"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
|
1338 {"GreenYellow" , PALETTERGB (173,255, 47)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1339 {"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
|
1340 {"LimeGreen" , PALETTERGB ( 50,205, 50)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1341 {"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
|
1342 {"YellowGreen" , PALETTERGB (154,205, 50)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1343 {"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
|
1344 {"ForestGreen" , PALETTERGB ( 34,139, 34)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1345 {"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
|
1346 {"OliveDrab" , PALETTERGB (107,142, 35)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1347 {"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
|
1348 {"DarkKhaki" , PALETTERGB (189,183,107)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1349 {"khaki" , PALETTERGB (240,230,140)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1350 {"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
|
1351 {"PaleGoldenrod" , PALETTERGB (238,232,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1352 {"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
|
1353 {"LightGoldenrodYellow" , PALETTERGB (250,250,210)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1354 {"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
|
1355 {"LightYellow" , PALETTERGB (255,255,224)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1356 {"yellow" , PALETTERGB (255,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1357 {"gold" , PALETTERGB (255,215, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1358 {"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
|
1359 {"LightGoldenrod" , PALETTERGB (238,221,130)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1360 {"goldenrod" , PALETTERGB (218,165, 32)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1361 {"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
|
1362 {"DarkGoldenrod" , PALETTERGB (184,134, 11)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1363 {"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
|
1364 {"RosyBrown" , PALETTERGB (188,143,143)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1365 {"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
|
1366 {"IndianRed" , PALETTERGB (205, 92, 92)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1367 {"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
|
1368 {"SaddleBrown" , PALETTERGB (139, 69, 19)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1369 {"sienna" , PALETTERGB (160, 82, 45)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1370 {"peru" , PALETTERGB (205,133, 63)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1371 {"burlywood" , PALETTERGB (222,184,135)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1372 {"beige" , PALETTERGB (245,245,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1373 {"wheat" , PALETTERGB (245,222,179)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1374 {"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
|
1375 {"SandyBrown" , PALETTERGB (244,164, 96)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1376 {"tan" , PALETTERGB (210,180,140)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1377 {"chocolate" , PALETTERGB (210,105, 30)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1378 {"firebrick" , PALETTERGB (178,34, 34)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1379 {"brown" , PALETTERGB (165,42, 42)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1380 {"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
|
1381 {"DarkSalmon" , PALETTERGB (233,150,122)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1382 {"salmon" , PALETTERGB (250,128,114)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1383 {"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
|
1384 {"LightSalmon" , PALETTERGB (255,160,122)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1385 {"orange" , PALETTERGB (255,165, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1386 {"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
|
1387 {"DarkOrange" , PALETTERGB (255,140, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1388 {"coral" , PALETTERGB (255,127, 80)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1389 {"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
|
1390 {"LightCoral" , PALETTERGB (240,128,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1391 {"tomato" , PALETTERGB (255, 99, 71)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1392 {"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
|
1393 {"OrangeRed" , PALETTERGB (255, 69, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1394 {"red" , PALETTERGB (255, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1395 {"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
|
1396 {"HotPink" , PALETTERGB (255,105,180)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1397 {"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
|
1398 {"DeepPink" , PALETTERGB (255, 20,147)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1399 {"pink" , PALETTERGB (255,192,203)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1400 {"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
|
1401 {"LightPink" , PALETTERGB (255,182,193)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1402 {"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
|
1403 {"PaleVioletRed" , PALETTERGB (219,112,147)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1404 {"maroon" , PALETTERGB (176, 48, 96)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1405 {"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
|
1406 {"MediumVioletRed" , PALETTERGB (199, 21,133)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1407 {"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
|
1408 {"VioletRed" , PALETTERGB (208, 32,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1409 {"magenta" , PALETTERGB (255, 0,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1410 {"violet" , PALETTERGB (238,130,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1411 {"plum" , PALETTERGB (221,160,221)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1412 {"orchid" , PALETTERGB (218,112,214)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1413 {"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
|
1414 {"MediumOrchid" , PALETTERGB (186, 85,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1415 {"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
|
1416 {"DarkOrchid" , PALETTERGB (153, 50,204)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1417 {"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
|
1418 {"DarkViolet" , PALETTERGB (148, 0,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1419 {"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
|
1420 {"BlueViolet" , PALETTERGB (138, 43,226)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1421 {"purple" , PALETTERGB (160, 32,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1422 {"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
|
1423 {"MediumPurple" , PALETTERGB (147,112,219)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1424 {"thistle" , PALETTERGB (216,191,216)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1425 {"gray0" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1426 {"grey0" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1427 {"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
|
1428 {"DarkGrey" , PALETTERGB (169,169,169)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1429 {"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
|
1430 {"DarkGray" , PALETTERGB (169,169,169)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1431 {"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
|
1432 {"DarkBlue" , PALETTERGB ( 0, 0,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1433 {"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
|
1434 {"DarkCyan" , PALETTERGB ( 0,139,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1435 {"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
|
1436 {"DarkMagenta" , PALETTERGB (139, 0,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1437 {"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
|
1438 {"DarkRed" , PALETTERGB (139, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1439 {"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
|
1440 {"LightGreen" , PALETTERGB (144,238,144)}, |
13434 | 1441 }; |
1442 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1443 DEFUN ("w32-default-color-map", Fw32_default_color_map, Sw32_default_color_map, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1444 0, 0, 0, doc: /* Return the default color map. */) |
13434 | 1445 () |
1446 { | |
1447 int i; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1448 colormap_t *pc = w32_color_map; |
13434 | 1449 Lisp_Object cmap; |
1450 | |
1451 BLOCK_INPUT; | |
1452 | |
1453 cmap = Qnil; | |
1454 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1455 for (i = 0; i < sizeof (w32_color_map) / sizeof (w32_color_map[0]); |
13434 | 1456 pc++, i++) |
1457 cmap = Fcons (Fcons (build_string (pc->name), | |
1458 make_number (pc->colorref)), | |
1459 cmap); | |
1460 | |
1461 UNBLOCK_INPUT; | |
1462 | |
1463 return (cmap); | |
1464 } | |
1465 | |
1466 Lisp_Object | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1467 w32_to_x_color (rgb) |
13434 | 1468 Lisp_Object rgb; |
1469 { | |
1470 Lisp_Object color; | |
1471 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
1472 CHECK_NUMBER (rgb); |
13434 | 1473 |
1474 BLOCK_INPUT; | |
1475 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1476 color = Frassq (rgb, Vw32_color_map); |
13434 | 1477 |
1478 UNBLOCK_INPUT; | |
1479 | |
1480 if (!NILP (color)) | |
1481 return (Fcar (color)); | |
1482 else | |
1483 return Qnil; | |
1484 } | |
1485 | |
23314
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1486 COLORREF |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1487 w32_color_map_lookup (colorname) |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1488 char *colorname; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1489 { |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1490 Lisp_Object tail, ret = Qnil; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1491 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1492 BLOCK_INPUT; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1493 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1494 for (tail = Vw32_color_map; !NILP (tail); tail = Fcdr (tail)) |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1495 { |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1496 register Lisp_Object elt, tem; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1497 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1498 elt = Fcar (tail); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1499 if (!CONSP (elt)) continue; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1500 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1501 tem = Fcar (elt); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1502 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1503 if (lstrcmpi (XSTRING (tem)->data, colorname) == 0) |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1504 { |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1505 ret = XUINT (Fcdr (elt)); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1506 break; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1507 } |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1508 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1509 QUIT; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1510 } |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1511 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1512 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1513 UNBLOCK_INPUT; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1514 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1515 return ret; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1516 } |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1517 |
13434 | 1518 COLORREF |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1519 x_to_w32_color (colorname) |
13434 | 1520 char * colorname; |
1521 { | |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
1522 register Lisp_Object ret = Qnil; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
1523 |
13434 | 1524 BLOCK_INPUT; |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1525 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1526 if (colorname[0] == '#') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1527 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1528 /* Could be an old-style RGB Device specification. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1529 char *color; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1530 int size; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1531 color = colorname + 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1532 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1533 size = strlen(color); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1534 if (size == 3 || size == 6 || size == 9 || size == 12) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1535 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1536 UINT colorval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1537 int i, pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1538 pos = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1539 size /= 3; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1540 colorval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1541 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1542 for (i = 0; i < 3; i++) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1543 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1544 char *end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1545 char t; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1546 unsigned long value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1547 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1548 /* The check for 'x' in the following conditional takes into |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1549 account the fact that strtol allows a "0x" in front of |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1550 our numbers, and we don't. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1551 if (!isxdigit(color[0]) || color[1] == 'x') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1552 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1553 t = color[size]; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1554 color[size] = '\0'; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1555 value = strtoul(color, &end, 16); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1556 color[size] = t; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1557 if (errno == ERANGE || end - color != size) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1558 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1559 switch (size) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1560 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1561 case 1: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1562 value = value * 0x10; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1563 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1564 case 2: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1565 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1566 case 3: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1567 value /= 0x10; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1568 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1569 case 4: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1570 value /= 0x100; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1571 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1572 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1573 colorval |= (value << pos); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1574 pos += 0x8; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1575 if (i == 2) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1576 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1577 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1578 return (colorval); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1579 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1580 color = end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1581 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1582 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1583 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1584 else if (strnicmp(colorname, "rgb:", 4) == 0) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1585 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1586 char *color; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1587 UINT colorval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1588 int i, pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1589 pos = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1590 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1591 colorval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1592 color = colorname + 4; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1593 for (i = 0; i < 3; i++) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1594 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1595 char *end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1596 unsigned long value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1597 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1598 /* The check for 'x' in the following conditional takes into |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1599 account the fact that strtol allows a "0x" in front of |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1600 our numbers, and we don't. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1601 if (!isxdigit(color[0]) || color[1] == 'x') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1602 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1603 value = strtoul(color, &end, 16); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1604 if (errno == ERANGE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1605 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1606 switch (end - color) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1607 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1608 case 1: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1609 value = value * 0x10 + value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1610 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1611 case 2: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1612 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1613 case 3: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1614 value /= 0x10; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1615 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1616 case 4: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1617 value /= 0x100; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1618 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1619 default: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1620 value = ULONG_MAX; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1621 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1622 if (value == ULONG_MAX) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1623 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1624 colorval |= (value << pos); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1625 pos += 0x8; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1626 if (i == 2) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1627 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1628 if (*end != '\0') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1629 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1630 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1631 return (colorval); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1632 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1633 if (*end != '/') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1634 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1635 color = end + 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1636 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1637 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1638 else if (strnicmp(colorname, "rgbi:", 5) == 0) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1639 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1640 /* This is an RGB Intensity specification. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1641 char *color; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1642 UINT colorval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1643 int i, pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1644 pos = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1645 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1646 colorval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1647 color = colorname + 5; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1648 for (i = 0; i < 3; i++) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1649 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1650 char *end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1651 double value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1652 UINT val; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1653 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1654 value = strtod(color, &end); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1655 if (errno == ERANGE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1656 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1657 if (value < 0.0 || value > 1.0) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1658 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1659 val = (UINT)(0x100 * value); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1660 /* We used 0x100 instead of 0xFF to give an continuous |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1661 range between 0.0 and 1.0 inclusive. The next statement |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1662 fixes the 1.0 case. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1663 if (val == 0x100) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1664 val = 0xFF; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1665 colorval |= (val << pos); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1666 pos += 0x8; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1667 if (i == 2) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1668 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1669 if (*end != '\0') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1670 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1671 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1672 return (colorval); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1673 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1674 if (*end != '/') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1675 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1676 color = end + 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1677 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1678 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1679 /* I am not going to attempt to handle any of the CIE color schemes |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1680 or TekHVC, since I don't know the algorithms for conversion to |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1681 RGB. */ |
23314
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1682 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1683 /* If we fail to lookup the color name in w32_color_map, then check the |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1684 colorname to see if it can be crudely approximated: If the X color |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1685 ends in a number (e.g., "darkseagreen2"), strip the number and |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1686 return the result of looking up the base color name. */ |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1687 ret = w32_color_map_lookup (colorname); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1688 if (NILP (ret)) |
13434 | 1689 { |
23314
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1690 int len = strlen (colorname); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1691 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1692 if (isdigit (colorname[len - 1])) |
13434 | 1693 { |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
1694 char *ptr, *approx = alloca (len + 1); |
23314
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1695 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1696 strcpy (approx, colorname); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1697 ptr = &approx[len - 1]; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1698 while (ptr > approx && isdigit (*ptr)) |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1699 *ptr-- = '\0'; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1700 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1701 ret = w32_color_map_lookup (approx); |
13434 | 1702 } |
1703 } | |
1704 | |
1705 UNBLOCK_INPUT; | |
1706 return ret; | |
1707 } | |
1708 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1709 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1710 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1711 w32_regenerate_palette (FRAME_PTR f) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1712 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1713 struct w32_palette_entry * list; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1714 LOGPALETTE * log_palette; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1715 HPALETTE new_palette; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1716 int i; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1717 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1718 /* don't bother trying to create palette if not supported */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1719 if (! FRAME_W32_DISPLAY_INFO (f)->has_palette) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1720 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1721 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1722 log_palette = (LOGPALETTE *) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1723 alloca (sizeof (LOGPALETTE) + |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1724 FRAME_W32_DISPLAY_INFO (f)->num_colors * sizeof (PALETTEENTRY)); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1725 log_palette->palVersion = 0x300; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1726 log_palette->palNumEntries = FRAME_W32_DISPLAY_INFO (f)->num_colors; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1727 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1728 list = FRAME_W32_DISPLAY_INFO (f)->color_list; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1729 for (i = 0; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1730 i < FRAME_W32_DISPLAY_INFO (f)->num_colors; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1731 i++, list = list->next) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1732 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
|
1733 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1734 new_palette = CreatePalette (log_palette); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1735 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1736 enter_crit (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1737 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1738 if (FRAME_W32_DISPLAY_INFO (f)->palette) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1739 DeleteObject (FRAME_W32_DISPLAY_INFO (f)->palette); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1740 FRAME_W32_DISPLAY_INFO (f)->palette = new_palette; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1741 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1742 /* 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
|
1743 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
|
1744 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1745 leave_crit (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1746 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1747 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1748 #define W32_COLOR(pe) RGB (pe.peRed, pe.peGreen, pe.peBlue) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1749 #define SET_W32_COLOR(pe, color) \ |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1750 do \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1751 { \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1752 pe.peRed = GetRValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1753 pe.peGreen = GetGValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1754 pe.peBlue = GetBValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1755 pe.peFlags = 0; \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1756 } while (0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1757 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1758 #if 0 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1759 /* 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
|
1760 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1761 w32_map_color (FRAME_PTR f, COLORREF color) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1762 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1763 struct w32_palette_entry * list = FRAME_W32_DISPLAY_INFO (f)->color_list; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1764 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1765 if (NILP (Vw32_enable_palette)) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1766 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1767 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1768 /* 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
|
1769 while (list) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1770 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1771 if (W32_COLOR (list->entry) == color) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1772 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1773 ++list->refcount; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1774 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1775 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1776 list = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1777 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1778 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1779 /* not already mapped, so add to list and recreate Windows palette */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1780 list = (struct w32_palette_entry *) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1781 xmalloc (sizeof (struct w32_palette_entry)); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1782 SET_W32_COLOR (list->entry, color); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1783 list->refcount = 1; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1784 list->next = FRAME_W32_DISPLAY_INFO (f)->color_list; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1785 FRAME_W32_DISPLAY_INFO (f)->color_list = list; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1786 FRAME_W32_DISPLAY_INFO (f)->num_colors++; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1787 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1788 /* set flag that palette must be regenerated */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1789 FRAME_W32_DISPLAY_INFO (f)->regen_palette = TRUE; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1790 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1791 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1792 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1793 w32_unmap_color (FRAME_PTR f, COLORREF color) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1794 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1795 struct w32_palette_entry * list = FRAME_W32_DISPLAY_INFO (f)->color_list; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1796 struct w32_palette_entry **prev = &FRAME_W32_DISPLAY_INFO (f)->color_list; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1797 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1798 if (NILP (Vw32_enable_palette)) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1799 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1800 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1801 /* 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
|
1802 while (list) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1803 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1804 if (W32_COLOR (list->entry) == color) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1805 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1806 if (--list->refcount == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1807 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1808 *prev = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1809 xfree (list); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1810 FRAME_W32_DISPLAY_INFO (f)->num_colors--; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1811 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1812 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1813 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1814 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1815 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1816 prev = &list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1817 list = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1818 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1819 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1820 /* set flag that palette must be regenerated */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1821 FRAME_W32_DISPLAY_INFO (f)->regen_palette = TRUE; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1822 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1823 #endif |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1824 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1825 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1826 /* Gamma-correct COLOR on frame F. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1827 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1828 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1829 gamma_correct (f, color) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1830 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1831 COLORREF *color; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1832 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1833 if (f->gamma) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1834 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1835 *color = PALETTERGB ( |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1836 pow (GetRValue (*color) / 255.0, f->gamma) * 255.0 + 0.5, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1837 pow (GetGValue (*color) / 255.0, f->gamma) * 255.0 + 0.5, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1838 pow (GetBValue (*color) / 255.0, f->gamma) * 255.0 + 0.5); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1839 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1840 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1841 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1842 |
13434 | 1843 /* Decide if color named COLOR is valid for the display associated with |
1844 the selected frame; if so, return the rgb values in COLOR_DEF. | |
1845 If ALLOC is nonzero, allocate a new colormap cell. */ | |
1846 | |
1847 int | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1848 w32_defined_color (f, color, color_def, alloc) |
13434 | 1849 FRAME_PTR f; |
1850 char *color; | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1851 XColor *color_def; |
13434 | 1852 int alloc; |
1853 { | |
1854 register Lisp_Object tem; | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1855 COLORREF w32_color_ref; |
14353 | 1856 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1857 tem = x_to_w32_color (color); |
14353 | 1858 |
13434 | 1859 if (!NILP (tem)) |
1860 { | |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1861 if (f) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1862 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1863 /* Apply gamma correction. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1864 w32_color_ref = XUINT (tem); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1865 gamma_correct (f, &w32_color_ref); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1866 XSETINT (tem, w32_color_ref); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1867 } |
27407
7df920562cbe
(w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents:
27397
diff
changeset
|
1868 |
7df920562cbe
(w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents:
27397
diff
changeset
|
1869 /* Map this color to the palette if it is enabled. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1870 if (!NILP (Vw32_enable_palette)) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1871 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1872 struct w32_palette_entry * entry = |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1873 one_w32_display_info.color_list; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1874 struct w32_palette_entry ** prev = |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1875 &one_w32_display_info.color_list; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1876 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1877 /* 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
|
1878 while (entry) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1879 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1880 if (W32_COLOR (entry->entry) == XUINT (tem)) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1881 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1882 prev = &entry->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1883 entry = entry->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1884 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1885 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1886 if (entry == NULL && alloc) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1887 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1888 /* not already mapped, so add to list */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1889 entry = (struct w32_palette_entry *) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1890 xmalloc (sizeof (struct w32_palette_entry)); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1891 SET_W32_COLOR (entry->entry, XUINT (tem)); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1892 entry->next = NULL; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1893 *prev = entry; |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1894 one_w32_display_info.num_colors++; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1895 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1896 /* set flag that palette must be regenerated */ |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1897 one_w32_display_info.regen_palette = TRUE; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1898 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1899 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1900 /* 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
|
1901 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
|
1902 or not the display device has a palette. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1903 w32_color_ref = XUINT (tem) | 0x2000000; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1904 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1905 color_def->pixel = w32_color_ref; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1906 color_def->red = GetRValue (w32_color_ref); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1907 color_def->green = GetGValue (w32_color_ref); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1908 color_def->blue = GetBValue (w32_color_ref); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1909 |
13434 | 1910 return 1; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1911 } |
13434 | 1912 else |
14353 | 1913 { |
1914 return 0; | |
1915 } | |
13434 | 1916 } |
1917 | |
1918 /* Given a string ARG naming a color, compute a pixel value from it | |
1919 suitable for screen F. | |
1920 If F is not a color screen, return DEF (default) regardless of what | |
1921 ARG says. */ | |
1922 | |
1923 int | |
1924 x_decode_color (f, arg, def) | |
1925 FRAME_PTR f; | |
1926 Lisp_Object arg; | |
1927 int def; | |
1928 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1929 XColor cdef; |
13434 | 1930 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
1931 CHECK_STRING (arg); |
13434 | 1932 |
1933 if (strcmp (XSTRING (arg)->data, "black") == 0) | |
1934 return BLACK_PIX_DEFAULT (f); | |
1935 else if (strcmp (XSTRING (arg)->data, "white") == 0) | |
1936 return WHITE_PIX_DEFAULT (f); | |
1937 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1938 if ((FRAME_W32_DISPLAY_INFO (f)->n_planes * FRAME_W32_DISPLAY_INFO (f)->n_cbits) == 1) |
13434 | 1939 return def; |
1940 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1941 /* w32_defined_color is responsible for coping with failures |
13434 | 1942 by looking for a near-miss. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1943 if (w32_defined_color (f, XSTRING (arg)->data, &cdef, 1)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1944 return cdef.pixel; |
13434 | 1945 |
1946 /* defined_color failed; return an ultimate default. */ | |
1947 return def; | |
1948 } | |
1949 | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1950 /* Change the `line-spacing' frame parameter of frame F. OLD_VALUE is |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1951 the previous value of that parameter, NEW_VALUE is the new value. */ |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1952 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1953 static void |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1954 x_set_line_spacing (f, new_value, old_value) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1955 struct frame *f; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1956 Lisp_Object new_value, old_value; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1957 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1958 if (NILP (new_value)) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1959 f->extra_line_spacing = 0; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1960 else if (NATNUMP (new_value)) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1961 f->extra_line_spacing = XFASTINT (new_value); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1962 else |
30601
7c995a54a0e8
Replace `illegal' with `invalid'.
Gerd Moellmann <gerd@gnu.org>
parents:
30239
diff
changeset
|
1963 Fsignal (Qerror, Fcons (build_string ("Invalid line-spacing"), |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1964 Fcons (new_value, Qnil))); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1965 if (FRAME_VISIBLE_P (f)) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1966 redraw_frame (f); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1967 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1968 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1969 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1970 /* Change the `screen-gamma' frame parameter of frame F. OLD_VALUE is |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1971 the previous value of that parameter, NEW_VALUE is the new value. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1972 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1973 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1974 x_set_screen_gamma (f, new_value, old_value) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1975 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1976 Lisp_Object new_value, old_value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1977 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1978 if (NILP (new_value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1979 f->gamma = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1980 else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1981 /* The value 0.4545 is the normal viewing gamma. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1982 f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1983 else |
30601
7c995a54a0e8
Replace `illegal' with `invalid'.
Gerd Moellmann <gerd@gnu.org>
parents:
30239
diff
changeset
|
1984 Fsignal (Qerror, Fcons (build_string ("Invalid screen-gamma"), |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1985 Fcons (new_value, Qnil))); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1986 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1987 clear_face_cache (0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1988 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1989 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1990 |
13434 | 1991 /* Functions called only from `x_set_frame_param' |
1992 to set individual parameters. | |
1993 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1994 If FRAME_W32_WINDOW (f) is 0, |
13434 | 1995 the frame is being created and its window does not exist yet. |
1996 In that case, just record the parameter's new value | |
1997 in the standard place; do not attempt to change the window. */ | |
1998 | |
1999 void | |
2000 x_set_foreground_color (f, arg, oldval) | |
2001 struct frame *f; | |
2002 Lisp_Object arg, oldval; | |
2003 { | |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2004 struct w32_output *x = f->output_data.w32; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2005 PIX_TYPE fg, old_fg; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2006 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2007 fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2008 old_fg = FRAME_FOREGROUND_PIXEL (f); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2009 FRAME_FOREGROUND_PIXEL (f) = fg; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
2010 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2011 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 2012 { |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2013 if (x->cursor_pixel == old_fg) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2014 x->cursor_pixel = fg; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2015 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2016 update_face_from_frame_parameter (f, Qforeground_color, arg); |
13434 | 2017 if (FRAME_VISIBLE_P (f)) |
2018 redraw_frame (f); | |
2019 } | |
2020 } | |
2021 | |
2022 void | |
2023 x_set_background_color (f, arg, oldval) | |
2024 struct frame *f; | |
2025 Lisp_Object arg, oldval; | |
2026 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2027 FRAME_BACKGROUND_PIXEL (f) |
13434 | 2028 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); |
2029 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2030 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 2031 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2032 SetWindowLong (FRAME_W32_WINDOW (f), WND_BACKGROUND_INDEX, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2033 FRAME_BACKGROUND_PIXEL (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2034 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2035 update_face_from_frame_parameter (f, Qbackground_color, arg); |
13434 | 2036 |
2037 if (FRAME_VISIBLE_P (f)) | |
2038 redraw_frame (f); | |
2039 } | |
2040 } | |
2041 | |
2042 void | |
2043 x_set_mouse_color (f, arg, oldval) | |
2044 struct frame *f; | |
2045 Lisp_Object arg, oldval; | |
2046 { | |
2047 Cursor cursor, nontext_cursor, mode_cursor, cross_cursor; | |
17632
d2915156a803
(x_set_mouse_color): Update calls to x_catch_errors
Richard M. Stallman <rms@gnu.org>
parents:
16884
diff
changeset
|
2048 int count; |
13434 | 2049 int mask_color; |
2050 | |
2051 if (!EQ (Qnil, arg)) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2052 f->output_data.w32->mouse_pixel |
13434 | 2053 = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2054 mask_color = FRAME_BACKGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2055 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2056 /* Don't let pointers be invisible. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2057 if (mask_color == f->output_data.w32->mouse_pixel |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2058 && mask_color == FRAME_BACKGROUND_PIXEL (f)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2059 f->output_data.w32->mouse_pixel = FRAME_FOREGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2060 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
2061 #if 0 /* TODO : cursor changes */ |
13434 | 2062 BLOCK_INPUT; |
2063 | |
2064 /* It's not okay to crash if the user selects a screwy cursor. */ | |
17632
d2915156a803
(x_set_mouse_color): Update calls to x_catch_errors
Richard M. Stallman <rms@gnu.org>
parents:
16884
diff
changeset
|
2065 count = x_catch_errors (FRAME_W32_DISPLAY (f)); |
13434 | 2066 |
2067 if (!EQ (Qnil, Vx_pointer_shape)) | |
2068 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2069 CHECK_NUMBER (Vx_pointer_shape); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2070 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XINT (Vx_pointer_shape)); |
13434 | 2071 } |
2072 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2073 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_xterm); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2074 x_check_errors (FRAME_W32_DISPLAY (f), "bad text pointer cursor: %s"); |
13434 | 2075 |
2076 if (!EQ (Qnil, Vx_nontext_pointer_shape)) | |
2077 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2078 CHECK_NUMBER (Vx_nontext_pointer_shape); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2079 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), |
13434 | 2080 XINT (Vx_nontext_pointer_shape)); |
2081 } | |
2082 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2083 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_left_ptr); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2084 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s"); |
13434 | 2085 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2086 if (!EQ (Qnil, Vx_hourglass_pointer_shape)) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2087 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2088 CHECK_NUMBER (Vx_hourglass_pointer_shape); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2089 hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2090 XINT (Vx_hourglass_pointer_shape)); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2091 } |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2092 else |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2093 hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2094 x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2095 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2096 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s"); |
13434 | 2097 if (!EQ (Qnil, Vx_mode_pointer_shape)) |
2098 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2099 CHECK_NUMBER (Vx_mode_pointer_shape); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2100 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), |
13434 | 2101 XINT (Vx_mode_pointer_shape)); |
2102 } | |
2103 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2104 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_xterm); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2105 x_check_errors (FRAME_W32_DISPLAY (f), "bad modeline pointer cursor: %s"); |
13434 | 2106 |
2107 if (!EQ (Qnil, Vx_sensitive_text_pointer_shape)) | |
2108 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2109 CHECK_NUMBER (Vx_sensitive_text_pointer_shape); |
13434 | 2110 cross_cursor |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2111 = XCreateFontCursor (FRAME_W32_DISPLAY (f), |
13434 | 2112 XINT (Vx_sensitive_text_pointer_shape)); |
2113 } | |
2114 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2115 cross_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_crosshair); |
13434 | 2116 |
34133
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
2117 if (!NILP (Vx_window_horizontal_drag_shape)) |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
2118 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2119 CHECK_NUMBER (Vx_window_horizontal_drag_shape); |
34133
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
2120 horizontal_drag_cursor |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
2121 = XCreateFontCursor (FRAME_X_DISPLAY (f), |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
2122 XINT (Vx_window_horizontal_drag_shape)); |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
2123 } |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
2124 else |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
2125 horizontal_drag_cursor |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
2126 = XCreateFontCursor (FRAME_X_DISPLAY (f), XC_sb_h_double_arrow); |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
2127 |
13434 | 2128 /* Check and report errors with the above calls. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2129 x_check_errors (FRAME_W32_DISPLAY (f), "can't set cursor shape: %s"); |
17632
d2915156a803
(x_set_mouse_color): Update calls to x_catch_errors
Richard M. Stallman <rms@gnu.org>
parents:
16884
diff
changeset
|
2130 x_uncatch_errors (FRAME_W32_DISPLAY (f), count); |
13434 | 2131 |
2132 { | |
2133 XColor fore_color, back_color; | |
2134 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2135 fore_color.pixel = f->output_data.w32->mouse_pixel; |
13434 | 2136 back_color.pixel = mask_color; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2137 XQueryColor (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2138 DefaultColormap (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2139 DefaultScreen (FRAME_W32_DISPLAY (f))), |
13434 | 2140 &fore_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2141 XQueryColor (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2142 DefaultColormap (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2143 DefaultScreen (FRAME_W32_DISPLAY (f))), |
13434 | 2144 &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2145 XRecolorCursor (FRAME_W32_DISPLAY (f), cursor, |
13434 | 2146 &fore_color, &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2147 XRecolorCursor (FRAME_W32_DISPLAY (f), nontext_cursor, |
13434 | 2148 &fore_color, &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2149 XRecolorCursor (FRAME_W32_DISPLAY (f), mode_cursor, |
13434 | 2150 &fore_color, &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2151 XRecolorCursor (FRAME_W32_DISPLAY (f), cross_cursor, |
13434 | 2152 &fore_color, &back_color); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2153 XRecolorCursor (FRAME_W32_DISPLAY (f), hourglass_cursor, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2154 &fore_color, &back_color); |
13434 | 2155 } |
2156 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2157 if (FRAME_W32_WINDOW (f) != 0) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2158 XDefineCursor (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), cursor); |
13434 | 2159 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2160 if (cursor != f->output_data.w32->text_cursor && f->output_data.w32->text_cursor != 0) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2161 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->text_cursor); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2162 f->output_data.w32->text_cursor = cursor; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2163 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2164 if (nontext_cursor != f->output_data.w32->nontext_cursor |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2165 && f->output_data.w32->nontext_cursor != 0) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2166 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->nontext_cursor); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2167 f->output_data.w32->nontext_cursor = nontext_cursor; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2168 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2169 if (hourglass_cursor != f->output_data.w32->hourglass_cursor |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2170 && f->output_data.w32->hourglass_cursor != 0) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2171 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->hourglass_cursor); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2172 f->output_data.w32->hourglass_cursor = hourglass_cursor; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2173 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2174 if (mode_cursor != f->output_data.w32->modeline_cursor |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2175 && f->output_data.w32->modeline_cursor != 0) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2176 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2177 f->output_data.w32->modeline_cursor = mode_cursor; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2178 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2179 if (cross_cursor != f->output_data.w32->cross_cursor |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2180 && f->output_data.w32->cross_cursor != 0) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2181 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->cross_cursor); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2182 f->output_data.w32->cross_cursor = cross_cursor; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2183 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2184 XFlush (FRAME_W32_DISPLAY (f)); |
13434 | 2185 UNBLOCK_INPUT; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2186 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2187 update_face_from_frame_parameter (f, Qmouse_color, arg); |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
2188 #endif /* TODO */ |
13434 | 2189 } |
2190 | |
34062
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2191 /* Defined in w32term.c. */ |
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2192 void x_update_cursor (struct frame *f, int on_p); |
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2193 |
13434 | 2194 void |
2195 x_set_cursor_color (f, arg, oldval) | |
2196 struct frame *f; | |
2197 Lisp_Object arg, oldval; | |
2198 { | |
34062
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2199 unsigned long fore_pixel, pixel; |
13434 | 2200 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2201 if (!NILP (Vx_cursor_fore_pixel)) |
13434 | 2202 fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel, |
34062
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2203 WHITE_PIX_DEFAULT (f)); |
13434 | 2204 else |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2205 fore_pixel = FRAME_BACKGROUND_PIXEL (f); |
34062
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2206 |
34089 | 2207 pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
13434 | 2208 |
2209 /* Make sure that the cursor color differs from the background color. */ | |
34062
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2210 if (pixel == FRAME_BACKGROUND_PIXEL (f)) |
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2211 { |
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2212 pixel = f->output_data.w32->mouse_pixel; |
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2213 if (pixel == fore_pixel) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2214 fore_pixel = FRAME_BACKGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2215 } |
34062
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2216 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2217 FRAME_FOREGROUND_PIXEL (f) = fore_pixel; |
34062
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2218 f->output_data.w32->cursor_pixel = pixel; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2219 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2220 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 2221 { |
2222 if (FRAME_VISIBLE_P (f)) | |
2223 { | |
34062
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2224 x_update_cursor (f, 0); |
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2225 x_update_cursor (f, 1); |
13434 | 2226 } |
2227 } | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2228 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2229 update_face_from_frame_parameter (f, Qcursor_color, arg); |
13434 | 2230 } |
2231 | |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2232 /* Set the border-color of frame F to pixel value PIX. |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2233 Note that this does not fully take effect if done before |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2234 F has an window. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2235 void |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2236 x_set_border_pixel (f, pix) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2237 struct frame *f; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2238 int pix; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2239 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2240 f->output_data.w32->border_pixel = pix; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2241 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2242 if (FRAME_W32_WINDOW (f) != 0 && f->output_data.w32->border_width > 0) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2243 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2244 if (FRAME_VISIBLE_P (f)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2245 redraw_frame (f); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2246 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2247 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2248 |
13434 | 2249 /* Set the border-color of frame F to value described by ARG. |
2250 ARG can be a string naming a color. | |
2251 The border-color is used for the border that is drawn by the server. | |
2252 Note that this does not fully take effect if done before | |
2253 F has a window; it must be redone when the window is created. */ | |
2254 | |
2255 void | |
2256 x_set_border_color (f, arg, oldval) | |
2257 struct frame *f; | |
2258 Lisp_Object arg, oldval; | |
2259 { | |
2260 int pix; | |
2261 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2262 CHECK_STRING (arg); |
13434 | 2263 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
2264 x_set_border_pixel (f, pix); | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2265 update_face_from_frame_parameter (f, Qborder_color, arg); |
13434 | 2266 } |
2267 | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2268 /* Value is the internal representation of the specified cursor type |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2269 ARG. If type is BAR_CURSOR, return in *WIDTH the specified width |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2270 of the bar cursor. */ |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2271 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2272 enum text_cursor_kinds |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2273 x_specified_cursor_type (arg, width) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2274 Lisp_Object arg; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2275 int *width; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2276 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2277 enum text_cursor_kinds type; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2278 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2279 if (EQ (arg, Qbar)) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2280 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2281 type = BAR_CURSOR; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2282 *width = 2; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2283 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2284 else if (CONSP (arg) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2285 && EQ (XCAR (arg), Qbar) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2286 && INTEGERP (XCDR (arg)) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2287 && XINT (XCDR (arg)) >= 0) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2288 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2289 type = BAR_CURSOR; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2290 *width = XINT (XCDR (arg)); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2291 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2292 else if (NILP (arg)) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2293 type = NO_CURSOR; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2294 else |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2295 /* Treat anything unknown as "box cursor". |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2296 It was bad to signal an error; people have trouble fixing |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2297 .Xdefaults with Emacs, when it has something bad in it. */ |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2298 type = FILLED_BOX_CURSOR; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2299 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2300 return type; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2301 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2302 |
13434 | 2303 void |
2304 x_set_cursor_type (f, arg, oldval) | |
2305 FRAME_PTR f; | |
2306 Lisp_Object arg, oldval; | |
2307 { | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2308 int width; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2309 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2310 FRAME_DESIRED_CURSOR (f) = x_specified_cursor_type (arg, &width); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2311 f->output_data.w32->cursor_width = width; |
13434 | 2312 |
2313 /* Make sure the cursor gets redrawn. This is overkill, but how | |
2314 often do people change cursor types? */ | |
2315 update_mode_lines++; | |
2316 } | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2317 |
13434 | 2318 void |
2319 x_set_icon_type (f, arg, oldval) | |
2320 struct frame *f; | |
2321 Lisp_Object arg, oldval; | |
2322 { | |
2323 int result; | |
2324 | |
25235
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2325 if (NILP (arg) && NILP (oldval)) |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2326 return; |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2327 |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2328 if (STRINGP (arg) && STRINGP (oldval) |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2329 && EQ (Fstring_equal (oldval, arg), Qt)) |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2330 return; |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2331 |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2332 if (SYMBOLP (arg) && SYMBOLP (oldval) && EQ (arg, oldval)) |
13434 | 2333 return; |
2334 | |
2335 BLOCK_INPUT; | |
25235
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2336 |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2337 result = x_bitmap_icon (f, arg); |
13434 | 2338 if (result) |
2339 { | |
2340 UNBLOCK_INPUT; | |
2341 error ("No icon window available"); | |
2342 } | |
2343 | |
2344 UNBLOCK_INPUT; | |
2345 } | |
2346 | |
2347 /* Return non-nil if frame F wants a bitmap icon. */ | |
2348 | |
2349 Lisp_Object | |
2350 x_icon_type (f) | |
2351 FRAME_PTR f; | |
2352 { | |
2353 Lisp_Object tem; | |
2354 | |
2355 tem = assq_no_quit (Qicon_type, f->param_alist); | |
2356 if (CONSP (tem)) | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
2357 return XCDR (tem); |
13434 | 2358 else |
2359 return Qnil; | |
2360 } | |
2361 | |
2362 void | |
2363 x_set_icon_name (f, arg, oldval) | |
2364 struct frame *f; | |
2365 Lisp_Object arg, oldval; | |
2366 { | |
2367 if (STRINGP (arg)) | |
2368 { | |
2369 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | |
2370 return; | |
2371 } | |
2372 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | |
2373 return; | |
2374 | |
2375 f->icon_name = arg; | |
2376 | |
2377 #if 0 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2378 if (f->output_data.w32->icon_bitmap != 0) |
13434 | 2379 return; |
2380 | |
2381 BLOCK_INPUT; | |
2382 | |
2383 result = x_text_icon (f, | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2384 (char *) XSTRING ((!NILP (f->icon_name) |
13434 | 2385 ? f->icon_name |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2386 : !NILP (f->title) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2387 ? f->title |
13434 | 2388 : f->name))->data); |
2389 | |
2390 if (result) | |
2391 { | |
2392 UNBLOCK_INPUT; | |
2393 error ("No icon window available"); | |
2394 } | |
2395 | |
2396 /* If the window was unmapped (and its icon was mapped), | |
2397 the new icon is not mapped, so map the window in its stead. */ | |
2398 if (FRAME_VISIBLE_P (f)) | |
2399 { | |
2400 #ifdef USE_X_TOOLKIT | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2401 XtPopup (f->output_data.w32->widget, XtGrabNone); |
13434 | 2402 #endif |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2403 XMapWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f)); |
13434 | 2404 } |
2405 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2406 XFlush (FRAME_W32_DISPLAY (f)); |
13434 | 2407 UNBLOCK_INPUT; |
2408 #endif | |
2409 } | |
2410 | |
2411 extern Lisp_Object x_new_font (); | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2412 extern Lisp_Object x_new_fontset(); |
13434 | 2413 |
2414 void | |
2415 x_set_font (f, arg, oldval) | |
2416 struct frame *f; | |
2417 Lisp_Object arg, oldval; | |
2418 { | |
2419 Lisp_Object result; | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2420 Lisp_Object fontset_name; |
22625
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
2421 Lisp_Object frame; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2422 int old_fontset = FRAME_FONTSET(f); |
13434 | 2423 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2424 CHECK_STRING (arg); |
13434 | 2425 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2426 fontset_name = Fquery_fontset (arg, Qnil); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2427 |
13434 | 2428 BLOCK_INPUT; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2429 result = (STRINGP (fontset_name) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2430 ? x_new_fontset (f, XSTRING (fontset_name)->data) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2431 : x_new_font (f, XSTRING (arg)->data)); |
13434 | 2432 UNBLOCK_INPUT; |
2433 | |
2434 if (EQ (result, Qnil)) | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2435 error ("Font `%s' is not defined", XSTRING (arg)->data); |
13434 | 2436 else if (EQ (result, Qt)) |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2437 error ("The characters of the given font have varying widths"); |
13434 | 2438 else if (STRINGP (result)) |
2439 { | |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2440 if (STRINGP (fontset_name)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2441 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2442 /* Fontset names are built from ASCII font names, so the |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2443 names may be equal despite there was a change. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2444 if (old_fontset == FRAME_FONTSET (f)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2445 return; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2446 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2447 else if (!NILP (Fequal (result, oldval))) |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
2448 return; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2449 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2450 store_frame_param (f, Qfont, result); |
13434 | 2451 recompute_basic_faces (f); |
2452 } | |
2453 else | |
2454 abort (); | |
22625
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
2455 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2456 do_pending_window_change (0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2457 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2458 /* Don't call `face-set-after-frame-default' when faces haven't been |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2459 initialized yet. This is the case when called from |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2460 Fx_create_frame. In that case, the X widget or window doesn't |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2461 exist either, and we can end up in x_report_frame_params with a |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2462 null widget which gives a segfault. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2463 if (FRAME_FACE_CACHE (f)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2464 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2465 XSETFRAME (frame, f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2466 call1 (Qface_set_after_frame_default, frame); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2467 } |
13434 | 2468 } |
2469 | |
41726
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
2470 static void |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
2471 x_set_fringe_width (f, new_value, old_value) |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
2472 struct frame *f; |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
2473 Lisp_Object new_value, old_value; |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
2474 { |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
2475 x_compute_fringe_widths (f, 1); |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
2476 } |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
2477 |
13434 | 2478 void |
2479 x_set_border_width (f, arg, oldval) | |
2480 struct frame *f; | |
2481 Lisp_Object arg, oldval; | |
2482 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2483 CHECK_NUMBER (arg); |
13434 | 2484 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2485 if (XINT (arg) == f->output_data.w32->border_width) |
13434 | 2486 return; |
2487 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2488 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 2489 error ("Cannot change the border width of a window"); |
2490 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2491 f->output_data.w32->border_width = XINT (arg); |
13434 | 2492 } |
2493 | |
2494 void | |
2495 x_set_internal_border_width (f, arg, oldval) | |
2496 struct frame *f; | |
2497 Lisp_Object arg, oldval; | |
2498 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2499 int old = f->output_data.w32->internal_border_width; |
13434 | 2500 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2501 CHECK_NUMBER (arg); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2502 f->output_data.w32->internal_border_width = XINT (arg); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2503 if (f->output_data.w32->internal_border_width < 0) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2504 f->output_data.w32->internal_border_width = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2505 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2506 if (f->output_data.w32->internal_border_width == old) |
13434 | 2507 return; |
2508 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2509 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 2510 { |
2511 x_set_window_size (f, 0, f->width, f->height); | |
2512 SET_FRAME_GARBAGED (f); | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2513 do_pending_window_change (0); |
13434 | 2514 } |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
2515 else |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
2516 SET_FRAME_GARBAGED (f); |
13434 | 2517 } |
2518 | |
2519 void | |
2520 x_set_visibility (f, value, oldval) | |
2521 struct frame *f; | |
2522 Lisp_Object value, oldval; | |
2523 { | |
2524 Lisp_Object frame; | |
2525 XSETFRAME (frame, f); | |
2526 | |
2527 if (NILP (value)) | |
2528 Fmake_frame_invisible (frame, Qt); | |
2529 else if (EQ (value, Qicon)) | |
2530 Ficonify_frame (frame); | |
2531 else | |
2532 Fmake_frame_visible (frame); | |
2533 } | |
2534 | |
33870
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2535 |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2536 /* Change window heights in windows rooted in WINDOW by N lines. */ |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2537 |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2538 static void |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2539 x_change_window_heights (window, n) |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2540 Lisp_Object window; |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2541 int n; |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2542 { |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2543 struct window *w = XWINDOW (window); |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2544 |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2545 XSETFASTINT (w->top, XFASTINT (w->top) + n); |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2546 XSETFASTINT (w->height, XFASTINT (w->height) - n); |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2547 |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2548 if (INTEGERP (w->orig_top)) |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2549 XSETFASTINT (w->orig_top, XFASTINT (w->orig_top) + n); |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2550 if (INTEGERP (w->orig_height)) |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2551 XSETFASTINT (w->orig_height, XFASTINT (w->orig_height) - n); |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2552 |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2553 /* Handle just the top child in a vertical split. */ |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2554 if (!NILP (w->vchild)) |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2555 x_change_window_heights (w->vchild, n); |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2556 |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2557 /* Adjust all children in a horizontal split. */ |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2558 for (window = w->hchild; !NILP (window); window = w->next) |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2559 { |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2560 w = XWINDOW (window); |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2561 x_change_window_heights (window, n); |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2562 } |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2563 } |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2564 |
13434 | 2565 void |
2566 x_set_menu_bar_lines (f, value, oldval) | |
2567 struct frame *f; | |
2568 Lisp_Object value, oldval; | |
2569 { | |
2570 int nlines; | |
2571 int olines = FRAME_MENU_BAR_LINES (f); | |
2572 | |
2573 /* Right now, menu bars don't work properly in minibuf-only frames; | |
2574 most of the commands try to apply themselves to the minibuffer | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2575 frame itself, and get an error because you can't switch buffers |
13434 | 2576 in or split the minibuffer window. */ |
2577 if (FRAME_MINIBUF_ONLY_P (f)) | |
2578 return; | |
2579 | |
2580 if (INTEGERP (value)) | |
2581 nlines = XINT (value); | |
2582 else | |
2583 nlines = 0; | |
2584 | |
2585 FRAME_MENU_BAR_LINES (f) = 0; | |
2586 if (nlines) | |
2587 FRAME_EXTERNAL_MENU_BAR (f) = 1; | |
2588 else | |
2589 { | |
2590 if (FRAME_EXTERNAL_MENU_BAR (f) == 1) | |
2591 free_frame_menubar (f); | |
2592 FRAME_EXTERNAL_MENU_BAR (f) = 0; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2593 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2594 /* Adjust the frame size so that the client (text) dimensions |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2595 remain the same. This depends on FRAME_EXTERNAL_MENU_BAR being |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2596 set correctly. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2597 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2598 do_pending_window_change (0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2599 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2600 adjust_glyphs (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2601 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2602 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2603 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2604 /* Set the number of lines used for the tool bar of frame F to VALUE. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2605 VALUE not an integer, or < 0 means set the lines to zero. OLDVAL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2606 is the old number of tool bar lines. This function changes the |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2607 height of all windows on frame F to match the new tool bar height. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2608 The frame's height doesn't change. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2609 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2610 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2611 x_set_tool_bar_lines (f, value, oldval) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2612 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2613 Lisp_Object value, oldval; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2614 { |
33865
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2615 int delta, nlines, root_height; |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2616 Lisp_Object root_window; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2617 |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
2618 /* Treat tool bars like menu bars. */ |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
2619 if (FRAME_MINIBUF_ONLY_P (f)) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
2620 return; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
2621 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2622 /* Use VALUE only if an integer >= 0. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2623 if (INTEGERP (value) && XINT (value) >= 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2624 nlines = XFASTINT (value); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2625 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2626 nlines = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2627 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2628 /* Make sure we redisplay all windows in this frame. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2629 ++windows_or_buffers_changed; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2630 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2631 delta = nlines - FRAME_TOOL_BAR_LINES (f); |
33865
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2632 |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2633 /* Don't resize the tool-bar to more than we have room for. */ |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2634 root_window = FRAME_ROOT_WINDOW (f); |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2635 root_height = XINT (XWINDOW (root_window)->height); |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2636 if (root_height - delta < 1) |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2637 { |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2638 delta = root_height - 1; |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2639 nlines = FRAME_TOOL_BAR_LINES (f) + delta; |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2640 } |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2641 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2642 FRAME_TOOL_BAR_LINES (f) = nlines; |
33865
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2643 x_change_window_heights (root_window, delta); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2644 adjust_glyphs (f); |
33865
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2645 |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2646 /* We also have to make sure that the internal border at the top of |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2647 the frame, below the menu bar or tool bar, is redrawn when the |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2648 tool bar disappears. This is so because the internal border is |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2649 below the tool bar if one is displayed, but is below the menu bar |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2650 if there isn't a tool bar. The tool bar draws into the area |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2651 below the menu bar. */ |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2652 if (FRAME_W32_WINDOW (f) && FRAME_TOOL_BAR_LINES (f) == 0) |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2653 { |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2654 updating_frame = f; |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2655 clear_frame (); |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2656 clear_current_matrices (f); |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2657 updating_frame = NULL; |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2658 } |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2659 |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2660 /* If the tool bar gets smaller, the internal border below it |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2661 has to be cleared. It was formerly part of the display |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2662 of the larger tool bar, and updating windows won't clear it. */ |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2663 if (delta < 0) |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2664 { |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2665 int height = FRAME_INTERNAL_BORDER_WIDTH (f); |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2666 int width = PIXEL_WIDTH (f); |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2667 int y = nlines * CANON_Y_UNIT (f); |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2668 |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2669 BLOCK_INPUT; |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2670 { |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2671 HDC hdc = get_frame_dc (f); |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2672 w32_clear_area (f, hdc, 0, y, width, height); |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2673 release_frame_dc (f, hdc); |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2674 } |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2675 UNBLOCK_INPUT; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2676 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2677 if (WINDOWP (f->tool_bar_window)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2678 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); |
33865
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2679 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2680 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2681 |
13434 | 2682 |
2683 /* Change the name of frame F to NAME. If NAME is nil, set F's name to | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2684 w32_id_name. |
13434 | 2685 |
2686 If EXPLICIT is non-zero, that indicates that lisp code is setting the | |
2687 name; if NAME is a string, set F's name to NAME and set | |
2688 F->explicit_name; if NAME is Qnil, then clear F->explicit_name. | |
2689 | |
2690 If EXPLICIT is zero, that indicates that Emacs redisplay code is | |
2691 suggesting a new name, which lisp code should override; if | |
2692 F->explicit_name is set, ignore the new name; otherwise, set it. */ | |
2693 | |
2694 void | |
2695 x_set_name (f, name, explicit) | |
2696 struct frame *f; | |
2697 Lisp_Object name; | |
2698 int explicit; | |
2699 { | |
2700 /* Make sure that requests from lisp code override requests from | |
2701 Emacs redisplay code. */ | |
2702 if (explicit) | |
2703 { | |
2704 /* If we're switching from explicit to implicit, we had better | |
2705 update the mode lines and thereby update the title. */ | |
2706 if (f->explicit_name && NILP (name)) | |
2707 update_mode_lines = 1; | |
2708 | |
2709 f->explicit_name = ! NILP (name); | |
2710 } | |
2711 else if (f->explicit_name) | |
2712 return; | |
2713 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2714 /* If NAME is nil, set the name to the w32_id_name. */ |
13434 | 2715 if (NILP (name)) |
2716 { | |
2717 /* Check for no change needed in this very common case | |
2718 before we do any consing. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2719 if (!strcmp (FRAME_W32_DISPLAY_INFO (f)->w32_id_name, |
13434 | 2720 XSTRING (f->name)->data)) |
2721 return; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2722 name = build_string (FRAME_W32_DISPLAY_INFO (f)->w32_id_name); |
13434 | 2723 } |
2724 else | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2725 CHECK_STRING (name); |
13434 | 2726 |
2727 /* Don't change the name if it's already NAME. */ | |
2728 if (! NILP (Fstring_equal (name, f->name))) | |
2729 return; | |
2730 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2731 f->name = name; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2732 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2733 /* For setting the frame title, the title parameter should override |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2734 the name parameter. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2735 if (! NILP (f->title)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2736 name = f->title; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2737 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2738 if (FRAME_W32_WINDOW (f)) |
13434 | 2739 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2740 if (STRING_MULTIBYTE (name)) |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2741 name = ENCODE_SYSTEM (name); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2742 |
13434 | 2743 BLOCK_INPUT; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2744 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data); |
13434 | 2745 UNBLOCK_INPUT; |
2746 } | |
2747 } | |
2748 | |
2749 /* This function should be called when the user's lisp code has | |
2750 specified a name for the frame; the name will override any set by the | |
2751 redisplay code. */ | |
2752 void | |
2753 x_explicitly_set_name (f, arg, oldval) | |
2754 FRAME_PTR f; | |
2755 Lisp_Object arg, oldval; | |
2756 { | |
2757 x_set_name (f, arg, 1); | |
2758 } | |
2759 | |
2760 /* This function should be called by Emacs redisplay code to set the | |
2761 name; names set this way will never override names set by the user's | |
2762 lisp code. */ | |
2763 void | |
2764 x_implicitly_set_name (f, arg, oldval) | |
2765 FRAME_PTR f; | |
2766 Lisp_Object arg, oldval; | |
2767 { | |
2768 x_set_name (f, arg, 0); | |
2769 } | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2770 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2771 /* Change the title of frame F to NAME. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2772 If NAME is nil, use the frame name as the title. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2773 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2774 If EXPLICIT is non-zero, that indicates that lisp code is setting the |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2775 name; if NAME is a string, set F's name to NAME and set |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2776 F->explicit_name; if NAME is Qnil, then clear F->explicit_name. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2777 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2778 If EXPLICIT is zero, that indicates that Emacs redisplay code is |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2779 suggesting a new name, which lisp code should override; if |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2780 F->explicit_name is set, ignore the new name; otherwise, set it. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2781 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2782 void |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2783 x_set_title (f, name, old_name) |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2784 struct frame *f; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2785 Lisp_Object name, old_name; |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2786 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2787 /* Don't change the title if it's already NAME. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2788 if (EQ (name, f->title)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2789 return; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2790 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2791 update_mode_lines = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2792 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2793 f->title = name; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2794 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2795 if (NILP (name)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2796 name = f->name; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2797 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2798 if (FRAME_W32_WINDOW (f)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2799 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2800 if (STRING_MULTIBYTE (name)) |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2801 name = ENCODE_SYSTEM (name); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2802 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2803 BLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2804 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2805 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2806 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2807 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2808 |
13434 | 2809 void |
2810 x_set_autoraise (f, arg, oldval) | |
2811 struct frame *f; | |
2812 Lisp_Object arg, oldval; | |
2813 { | |
2814 f->auto_raise = !EQ (Qnil, arg); | |
2815 } | |
2816 | |
2817 void | |
2818 x_set_autolower (f, arg, oldval) | |
2819 struct frame *f; | |
2820 Lisp_Object arg, oldval; | |
2821 { | |
2822 f->auto_lower = !EQ (Qnil, arg); | |
2823 } | |
2824 | |
2825 void | |
2826 x_set_unsplittable (f, arg, oldval) | |
2827 struct frame *f; | |
2828 Lisp_Object arg, oldval; | |
2829 { | |
2830 f->no_split = !NILP (arg); | |
2831 } | |
2832 | |
2833 void | |
2834 x_set_vertical_scroll_bars (f, arg, oldval) | |
2835 struct frame *f; | |
2836 Lisp_Object arg, oldval; | |
2837 { | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2838 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
|
2839 || (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
|
2840 || (NILP (arg) && FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2841 || (!NILP (arg) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f))) |
13434 | 2842 { |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2843 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = NILP (arg) ? |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2844 vertical_scroll_bar_none : |
21735
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
2845 /* Put scroll bars on the right by default, as is conventional |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
2846 on MS-Windows. */ |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
2847 EQ (Qleft, arg) |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
2848 ? vertical_scroll_bar_left |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
2849 : vertical_scroll_bar_right; |
13434 | 2850 |
2851 /* We set this parameter before creating the window for the | |
2852 frame, so we can get the geometry right from the start. | |
2853 However, if the window hasn't been created yet, we shouldn't | |
2854 call x_set_window_size. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2855 if (FRAME_W32_WINDOW (f)) |
13434 | 2856 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2857 do_pending_window_change (0); |
13434 | 2858 } |
2859 } | |
2860 | |
2861 void | |
2862 x_set_scroll_bar_width (f, arg, oldval) | |
2863 struct frame *f; | |
2864 Lisp_Object arg, oldval; | |
2865 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2866 int wid = FONT_WIDTH (f->output_data.w32->font); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2867 |
13434 | 2868 if (NILP (arg)) |
2869 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2870 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2871 FRAME_SCROLL_BAR_COLS (f) = (FRAME_SCROLL_BAR_PIXEL_WIDTH (f) + |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2872 wid - 1) / wid; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2873 if (FRAME_W32_WINDOW (f)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2874 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2875 do_pending_window_change (0); |
13434 | 2876 } |
2877 else if (INTEGERP (arg) && XINT (arg) > 0 | |
2878 && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f)) | |
2879 { | |
2880 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg); | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2881 FRAME_SCROLL_BAR_COLS (f) = (FRAME_SCROLL_BAR_PIXEL_WIDTH (f) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2882 + wid-1) / wid; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2883 if (FRAME_W32_WINDOW (f)) |
13434 | 2884 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2885 do_pending_window_change (0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2886 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2887 change_frame_size (f, 0, FRAME_WIDTH (f), 0, 0, 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2888 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2889 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0; |
13434 | 2890 } |
2891 | |
2892 /* Subroutines of creating an frame. */ | |
2893 | |
2894 /* Make sure that Vx_resource_name is set to a reasonable value. | |
2895 Fix it up, or set it to `emacs' if it is too hopeless. */ | |
2896 | |
2897 static void | |
2898 validate_x_resource_name () | |
2899 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2900 int len = 0; |
13434 | 2901 /* Number of valid characters in the resource name. */ |
2902 int good_count = 0; | |
2903 /* Number of invalid characters in the resource name. */ | |
2904 int bad_count = 0; | |
2905 Lisp_Object new; | |
2906 int i; | |
2907 | |
2908 if (STRINGP (Vx_resource_name)) | |
2909 { | |
2910 unsigned char *p = XSTRING (Vx_resource_name)->data; | |
2911 int i; | |
2912 | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2913 len = STRING_BYTES (XSTRING (Vx_resource_name)); |
13434 | 2914 |
2915 /* Only letters, digits, - and _ are valid in resource names. | |
2916 Count the valid characters and count the invalid ones. */ | |
2917 for (i = 0; i < len; i++) | |
2918 { | |
2919 int c = p[i]; | |
2920 if (! ((c >= 'a' && c <= 'z') | |
2921 || (c >= 'A' && c <= 'Z') | |
2922 || (c >= '0' && c <= '9') | |
2923 || c == '-' || c == '_')) | |
2924 bad_count++; | |
2925 else | |
2926 good_count++; | |
2927 } | |
2928 } | |
2929 else | |
2930 /* Not a string => completely invalid. */ | |
2931 bad_count = 5, good_count = 0; | |
2932 | |
2933 /* If name is valid already, return. */ | |
2934 if (bad_count == 0) | |
2935 return; | |
2936 | |
2937 /* If name is entirely invalid, or nearly so, use `emacs'. */ | |
2938 if (good_count == 0 | |
2939 || (good_count == 1 && bad_count > 0)) | |
2940 { | |
2941 Vx_resource_name = build_string ("emacs"); | |
2942 return; | |
2943 } | |
2944 | |
2945 /* Name is partly valid. Copy it and replace the invalid characters | |
2946 with underscores. */ | |
2947 | |
2948 Vx_resource_name = new = Fcopy_sequence (Vx_resource_name); | |
2949 | |
2950 for (i = 0; i < len; i++) | |
2951 { | |
2952 int c = XSTRING (new)->data[i]; | |
2953 if (! ((c >= 'a' && c <= 'z') | |
2954 || (c >= 'A' && c <= 'Z') | |
2955 || (c >= '0' && c <= '9') | |
2956 || c == '-' || c == '_')) | |
2957 XSTRING (new)->data[i] = '_'; | |
2958 } | |
2959 } | |
2960 | |
2961 | |
2962 extern char *x_get_string_resource (); | |
2963 | |
2964 DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 2, 4, 0, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
2965 doc: /* Return the value of ATTRIBUTE, of class CLASS, from the X defaults database. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
2966 This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
2967 class, where INSTANCE is the name under which Emacs was invoked, or |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
2968 the name specified by the `-name' or `-rn' command-line arguments. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
2969 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
2970 The optional arguments COMPONENT and SUBCLASS add to the key and the |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
2971 class, respectively. You must specify both of them or neither. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
2972 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE' |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
2973 and the class is `Emacs.CLASS.SUBCLASS'. */) |
13434 | 2974 (attribute, class, component, subclass) |
2975 Lisp_Object attribute, class, component, subclass; | |
2976 { | |
2977 register char *value; | |
2978 char *name_key; | |
2979 char *class_key; | |
2980 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2981 CHECK_STRING (attribute); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2982 CHECK_STRING (class); |
13434 | 2983 |
2984 if (!NILP (component)) | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2985 CHECK_STRING (component); |
13434 | 2986 if (!NILP (subclass)) |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2987 CHECK_STRING (subclass); |
13434 | 2988 if (NILP (component) != NILP (subclass)) |
2989 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither"); | |
2990 | |
2991 validate_x_resource_name (); | |
2992 | |
2993 /* Allocate space for the components, the dots which separate them, | |
2994 and the final '\0'. Make them big enough for the worst case. */ | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2995 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name)) |
13434 | 2996 + (STRINGP (component) |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2997 ? STRING_BYTES (XSTRING (component)) : 0) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2998 + STRING_BYTES (XSTRING (attribute)) |
13434 | 2999 + 3); |
3000 | |
3001 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
3002 + STRING_BYTES (XSTRING (class)) |
13434 | 3003 + (STRINGP (subclass) |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
3004 ? STRING_BYTES (XSTRING (subclass)) : 0) |
13434 | 3005 + 3); |
3006 | |
3007 /* Start with emacs.FRAMENAME for the name (the specific one) | |
3008 and with `Emacs' for the class key (the general one). */ | |
3009 strcpy (name_key, XSTRING (Vx_resource_name)->data); | |
3010 strcpy (class_key, EMACS_CLASS); | |
3011 | |
3012 strcat (class_key, "."); | |
3013 strcat (class_key, XSTRING (class)->data); | |
3014 | |
3015 if (!NILP (component)) | |
3016 { | |
3017 strcat (class_key, "."); | |
3018 strcat (class_key, XSTRING (subclass)->data); | |
3019 | |
3020 strcat (name_key, "."); | |
3021 strcat (name_key, XSTRING (component)->data); | |
3022 } | |
3023 | |
3024 strcat (name_key, "."); | |
3025 strcat (name_key, XSTRING (attribute)->data); | |
3026 | |
3027 value = x_get_string_resource (Qnil, | |
3028 name_key, class_key); | |
3029 | |
3030 if (value != (char *) 0) | |
3031 return build_string (value); | |
3032 else | |
3033 return Qnil; | |
3034 } | |
3035 | |
3036 /* Used when C code wants a resource value. */ | |
3037 | |
3038 char * | |
3039 x_get_resource_string (attribute, class) | |
3040 char *attribute, *class; | |
3041 { | |
3042 char *name_key; | |
3043 char *class_key; | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3044 struct frame *sf = SELECTED_FRAME (); |
13434 | 3045 |
3046 /* Allocate space for the components, the dots which separate them, | |
3047 and the final '\0'. */ | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
3048 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vinvocation_name)) |
13434 | 3049 + strlen (attribute) + 2); |
3050 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) | |
3051 + strlen (class) + 2); | |
3052 | |
3053 sprintf (name_key, "%s.%s", | |
3054 XSTRING (Vinvocation_name)->data, | |
3055 attribute); | |
3056 sprintf (class_key, "%s.%s", EMACS_CLASS, class); | |
3057 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3058 return x_get_string_resource (sf, name_key, class_key); |
13434 | 3059 } |
3060 | |
3061 /* Types we might convert a resource string into. */ | |
3062 enum resource_types | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3063 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3064 RES_TYPE_NUMBER, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3065 RES_TYPE_FLOAT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3066 RES_TYPE_BOOLEAN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3067 RES_TYPE_STRING, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3068 RES_TYPE_SYMBOL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3069 }; |
13434 | 3070 |
3071 /* Return the value of parameter PARAM. | |
3072 | |
3073 First search ALIST, then Vdefault_frame_alist, then the X defaults | |
3074 database, using ATTRIBUTE as the attribute name and CLASS as its class. | |
3075 | |
3076 Convert the resource to the type specified by desired_type. | |
3077 | |
3078 If no default is specified, return Qunbound. If you call | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3079 w32_get_arg, make sure you deal with Qunbound in a reasonable way, |
13434 | 3080 and don't let it get stored in any Lisp-visible variables! */ |
3081 | |
3082 static Lisp_Object | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3083 w32_get_arg (alist, param, attribute, class, type) |
13434 | 3084 Lisp_Object alist, param; |
3085 char *attribute; | |
3086 char *class; | |
3087 enum resource_types type; | |
3088 { | |
3089 register Lisp_Object tem; | |
3090 | |
3091 tem = Fassq (param, alist); | |
3092 if (EQ (tem, Qnil)) | |
3093 tem = Fassq (param, Vdefault_frame_alist); | |
3094 if (EQ (tem, Qnil)) | |
3095 { | |
3096 | |
3097 if (attribute) | |
3098 { | |
3099 tem = Fx_get_resource (build_string (attribute), | |
3100 build_string (class), | |
3101 Qnil, Qnil); | |
3102 | |
3103 if (NILP (tem)) | |
3104 return Qunbound; | |
3105 | |
3106 switch (type) | |
3107 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3108 case RES_TYPE_NUMBER: |
13434 | 3109 return make_number (atoi (XSTRING (tem)->data)); |
3110 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3111 case RES_TYPE_FLOAT: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3112 return make_float (atof (XSTRING (tem)->data)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3113 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3114 case RES_TYPE_BOOLEAN: |
13434 | 3115 tem = Fdowncase (tem); |
3116 if (!strcmp (XSTRING (tem)->data, "on") | |
3117 || !strcmp (XSTRING (tem)->data, "true")) | |
3118 return Qt; | |
3119 else | |
3120 return Qnil; | |
3121 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3122 case RES_TYPE_STRING: |
13434 | 3123 return tem; |
3124 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3125 case RES_TYPE_SYMBOL: |
13434 | 3126 /* As a special case, we map the values `true' and `on' |
3127 to Qt, and `false' and `off' to Qnil. */ | |
3128 { | |
3129 Lisp_Object lower; | |
3130 lower = Fdowncase (tem); | |
3131 if (!strcmp (XSTRING (lower)->data, "on") | |
3132 || !strcmp (XSTRING (lower)->data, "true")) | |
3133 return Qt; | |
3134 else if (!strcmp (XSTRING (lower)->data, "off") | |
3135 || !strcmp (XSTRING (lower)->data, "false")) | |
3136 return Qnil; | |
3137 else | |
3138 return Fintern (tem, Qnil); | |
3139 } | |
3140 | |
3141 default: | |
3142 abort (); | |
3143 } | |
3144 } | |
3145 else | |
3146 return Qunbound; | |
3147 } | |
3148 return Fcdr (tem); | |
3149 } | |
3150 | |
3151 /* Record in frame F the specified or default value according to ALIST | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
3152 of the parameter named PROP (a Lisp symbol). |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
3153 If no value is specified for PROP, look for an X default for XPROP |
13434 | 3154 on the frame named NAME. |
3155 If that is not found either, use the value DEFLT. */ | |
3156 | |
3157 static Lisp_Object | |
3158 x_default_parameter (f, alist, prop, deflt, xprop, xclass, type) | |
3159 struct frame *f; | |
3160 Lisp_Object alist; | |
3161 Lisp_Object prop; | |
3162 Lisp_Object deflt; | |
3163 char *xprop; | |
3164 char *xclass; | |
3165 enum resource_types type; | |
3166 { | |
3167 Lisp_Object tem; | |
3168 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3169 tem = w32_get_arg (alist, prop, xprop, xclass, type); |
13434 | 3170 if (EQ (tem, Qunbound)) |
3171 tem = deflt; | |
3172 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil)); | |
3173 return tem; | |
3174 } | |
3175 | |
3176 DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
3177 doc: /* Parse an X-style geometry string STRING. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
3178 Returns an alist of the form ((top . TOP), (left . LEFT) ... ). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
3179 The properties returned may include `top', `left', `height', and `width'. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
3180 The value of `left' or `top' may be an integer, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
3181 or a list (+ N) meaning N pixels relative to top/left corner, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
3182 or a list (- N) meaning -N pixels relative to bottom/right corner. */) |
13434 | 3183 (string) |
3184 Lisp_Object string; | |
3185 { | |
3186 int geometry, x, y; | |
3187 unsigned int width, height; | |
3188 Lisp_Object result; | |
3189 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
3190 CHECK_STRING (string); |
13434 | 3191 |
3192 geometry = XParseGeometry ((char *) XSTRING (string)->data, | |
3193 &x, &y, &width, &height); | |
3194 | |
3195 result = Qnil; | |
3196 if (geometry & XValue) | |
3197 { | |
3198 Lisp_Object element; | |
3199 | |
3200 if (x >= 0 && (geometry & XNegative)) | |
3201 element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil))); | |
3202 else if (x < 0 && ! (geometry & XNegative)) | |
3203 element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil))); | |
3204 else | |
3205 element = Fcons (Qleft, make_number (x)); | |
3206 result = Fcons (element, result); | |
3207 } | |
3208 | |
3209 if (geometry & YValue) | |
3210 { | |
3211 Lisp_Object element; | |
3212 | |
3213 if (y >= 0 && (geometry & YNegative)) | |
3214 element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil))); | |
3215 else if (y < 0 && ! (geometry & YNegative)) | |
3216 element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil))); | |
3217 else | |
3218 element = Fcons (Qtop, make_number (y)); | |
3219 result = Fcons (element, result); | |
3220 } | |
3221 | |
3222 if (geometry & WidthValue) | |
3223 result = Fcons (Fcons (Qwidth, make_number (width)), result); | |
3224 if (geometry & HeightValue) | |
3225 result = Fcons (Fcons (Qheight, make_number (height)), result); | |
3226 | |
3227 return result; | |
3228 } | |
3229 | |
3230 /* Calculate the desired size and position of this window, | |
3231 and return the flags saying which aspects were specified. | |
3232 | |
3233 This function does not make the coordinates positive. */ | |
3234 | |
3235 #define DEFAULT_ROWS 40 | |
3236 #define DEFAULT_COLS 80 | |
3237 | |
3238 static int | |
3239 x_figure_window_size (f, parms) | |
3240 struct frame *f; | |
3241 Lisp_Object parms; | |
3242 { | |
3243 register Lisp_Object tem0, tem1, tem2; | |
3244 long window_prompting = 0; | |
3245 | |
3246 /* Default values if we fall through. | |
3247 Actually, if that happens we should get | |
3248 window manager prompting. */ | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
3249 SET_FRAME_WIDTH (f, DEFAULT_COLS); |
13434 | 3250 f->height = DEFAULT_ROWS; |
3251 /* Window managers expect that if program-specified | |
3252 positions are not (0,0), they're intentional, not defaults. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3253 f->output_data.w32->top_pos = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3254 f->output_data.w32->left_pos = 0; |
13434 | 3255 |
34942
af688bd6c419
(x_figure_window_size): Do not allow new_height and
Jason Rumney <jasonr@gnu.org>
parents:
34729
diff
changeset
|
3256 /* Ensure that old new_width and new_height will not override the |
af688bd6c419
(x_figure_window_size): Do not allow new_height and
Jason Rumney <jasonr@gnu.org>
parents:
34729
diff
changeset
|
3257 values set here. */ |
af688bd6c419
(x_figure_window_size): Do not allow new_height and
Jason Rumney <jasonr@gnu.org>
parents:
34729
diff
changeset
|
3258 FRAME_NEW_WIDTH (f) = 0; |
af688bd6c419
(x_figure_window_size): Do not allow new_height and
Jason Rumney <jasonr@gnu.org>
parents:
34729
diff
changeset
|
3259 FRAME_NEW_HEIGHT (f) = 0; |
af688bd6c419
(x_figure_window_size): Do not allow new_height and
Jason Rumney <jasonr@gnu.org>
parents:
34729
diff
changeset
|
3260 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3261 tem0 = w32_get_arg (parms, Qheight, 0, 0, RES_TYPE_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3262 tem1 = w32_get_arg (parms, Qwidth, 0, 0, RES_TYPE_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3263 tem2 = w32_get_arg (parms, Quser_size, 0, 0, RES_TYPE_NUMBER); |
13434 | 3264 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) |
3265 { | |
3266 if (!EQ (tem0, Qunbound)) | |
3267 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
3268 CHECK_NUMBER (tem0); |
13434 | 3269 f->height = XINT (tem0); |
3270 } | |
3271 if (!EQ (tem1, Qunbound)) | |
3272 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
3273 CHECK_NUMBER (tem1); |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
3274 SET_FRAME_WIDTH (f, XINT (tem1)); |
13434 | 3275 } |
3276 if (!NILP (tem2) && !EQ (tem2, Qunbound)) | |
3277 window_prompting |= USSize; | |
3278 else | |
3279 window_prompting |= PSize; | |
3280 } | |
3281 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3282 f->output_data.w32->vertical_scroll_bar_extra |
13434 | 3283 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
3284 ? 0 | |
3285 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 | |
3286 ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3287 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font))); |
41726
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
3288 x_compute_fringe_widths (f, 0); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3289 f->output_data.w32->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3290 f->output_data.w32->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height); |
13434 | 3291 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3292 tem0 = w32_get_arg (parms, Qtop, 0, 0, RES_TYPE_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3293 tem1 = w32_get_arg (parms, Qleft, 0, 0, RES_TYPE_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3294 tem2 = w32_get_arg (parms, Quser_position, 0, 0, RES_TYPE_NUMBER); |
13434 | 3295 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) |
3296 { | |
3297 if (EQ (tem0, Qminus)) | |
3298 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3299 f->output_data.w32->top_pos = 0; |
13434 | 3300 window_prompting |= YNegative; |
3301 } | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3302 else if (CONSP (tem0) && EQ (XCAR (tem0), Qminus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3303 && CONSP (XCDR (tem0)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3304 && INTEGERP (XCAR (XCDR (tem0)))) |
13434 | 3305 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3306 f->output_data.w32->top_pos = - XINT (XCAR (XCDR (tem0))); |
13434 | 3307 window_prompting |= YNegative; |
3308 } | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3309 else if (CONSP (tem0) && EQ (XCAR (tem0), Qplus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3310 && CONSP (XCDR (tem0)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3311 && INTEGERP (XCAR (XCDR (tem0)))) |
13434 | 3312 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3313 f->output_data.w32->top_pos = XINT (XCAR (XCDR (tem0))); |
13434 | 3314 } |
3315 else if (EQ (tem0, Qunbound)) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3316 f->output_data.w32->top_pos = 0; |
13434 | 3317 else |
3318 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
3319 CHECK_NUMBER (tem0); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3320 f->output_data.w32->top_pos = XINT (tem0); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3321 if (f->output_data.w32->top_pos < 0) |
13434 | 3322 window_prompting |= YNegative; |
3323 } | |
3324 | |
3325 if (EQ (tem1, Qminus)) | |
3326 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3327 f->output_data.w32->left_pos = 0; |
13434 | 3328 window_prompting |= XNegative; |
3329 } | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3330 else if (CONSP (tem1) && EQ (XCAR (tem1), Qminus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3331 && CONSP (XCDR (tem1)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3332 && INTEGERP (XCAR (XCDR (tem1)))) |
13434 | 3333 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3334 f->output_data.w32->left_pos = - XINT (XCAR (XCDR (tem1))); |
13434 | 3335 window_prompting |= XNegative; |
3336 } | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3337 else if (CONSP (tem1) && EQ (XCAR (tem1), Qplus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3338 && CONSP (XCDR (tem1)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3339 && INTEGERP (XCAR (XCDR (tem1)))) |
13434 | 3340 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3341 f->output_data.w32->left_pos = XINT (XCAR (XCDR (tem1))); |
13434 | 3342 } |
3343 else if (EQ (tem1, Qunbound)) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3344 f->output_data.w32->left_pos = 0; |
13434 | 3345 else |
3346 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
3347 CHECK_NUMBER (tem1); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3348 f->output_data.w32->left_pos = XINT (tem1); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3349 if (f->output_data.w32->left_pos < 0) |
13434 | 3350 window_prompting |= XNegative; |
3351 } | |
3352 | |
3353 if (!NILP (tem2) && ! EQ (tem2, Qunbound)) | |
3354 window_prompting |= USPosition; | |
3355 else | |
3356 window_prompting |= PPosition; | |
3357 } | |
3358 | |
3359 return window_prompting; | |
3360 } | |
3361 | |
3362 | |
3363 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3364 extern LRESULT CALLBACK w32_wnd_proc (); |
13434 | 3365 |
3366 BOOL | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3367 w32_init_class (hinst) |
13434 | 3368 HINSTANCE hinst; |
3369 { | |
3370 WNDCLASS wc; | |
3371 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3372 wc.style = CS_HREDRAW | CS_VREDRAW; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3373 wc.lpfnWndProc = (WNDPROC) w32_wnd_proc; |
13434 | 3374 wc.cbClsExtra = 0; |
3375 wc.cbWndExtra = WND_EXTRA_BYTES; | |
3376 wc.hInstance = hinst; | |
3377 wc.hIcon = LoadIcon (hinst, EMACS_CLASS); | |
3378 wc.hCursor = LoadCursor (NULL, IDC_ARROW); | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
3379 wc.hbrBackground = NULL; /* GetStockObject (WHITE_BRUSH); */ |
13434 | 3380 wc.lpszMenuName = NULL; |
3381 wc.lpszClassName = EMACS_CLASS; | |
3382 | |
3383 return (RegisterClass (&wc)); | |
3384 } | |
3385 | |
3386 HWND | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3387 w32_createscrollbar (f, bar) |
13434 | 3388 struct frame *f; |
3389 struct scroll_bar * bar; | |
3390 { | |
3391 return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE, | |
3392 /* Position and size of scroll bar. */ | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3393 XINT(bar->left) + VERTICAL_SCROLL_BAR_WIDTH_TRIM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3394 XINT(bar->top), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3395 XINT(bar->width) - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3396 XINT(bar->height), |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3397 FRAME_W32_WINDOW (f), |
13434 | 3398 NULL, |
3399 hinst, | |
3400 NULL)); | |
3401 } | |
3402 | |
3403 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3404 w32_createwindow (f) |
13434 | 3405 struct frame *f; |
3406 { | |
3407 HWND hwnd; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3408 RECT rect; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3409 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3410 rect.left = rect.top = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3411 rect.right = PIXEL_WIDTH (f); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3412 rect.bottom = PIXEL_HEIGHT (f); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3413 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3414 AdjustWindowRect (&rect, f->output_data.w32->dwStyle, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3415 FRAME_EXTERNAL_MENU_BAR (f)); |
13434 | 3416 |
3417 /* Do first time app init */ | |
3418 | |
3419 if (!hprevinst) | |
3420 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3421 w32_init_class (hinst); |
13434 | 3422 } |
3423 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3424 FRAME_W32_WINDOW (f) = hwnd |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3425 = CreateWindow (EMACS_CLASS, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3426 f->namebuf, |
39137
2d2b989f4a4b
(w32_createwindow): Undo last change.
Andrew Innes <andrewi@gnu.org>
parents:
39128
diff
changeset
|
3427 f->output_data.w32->dwStyle | WS_CLIPCHILDREN, |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3428 f->output_data.w32->left_pos, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3429 f->output_data.w32->top_pos, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3430 rect.right - rect.left, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3431 rect.bottom - rect.top, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3432 NULL, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3433 NULL, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3434 hinst, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3435 NULL); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3436 |
13434 | 3437 if (hwnd) |
3438 { | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3439 SetWindowLong (hwnd, WND_FONTWIDTH_INDEX, FONT_WIDTH (f->output_data.w32->font)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3440 SetWindowLong (hwnd, WND_LINEHEIGHT_INDEX, f->output_data.w32->line_height); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3441 SetWindowLong (hwnd, WND_BORDER_INDEX, f->output_data.w32->internal_border_width); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3442 SetWindowLong (hwnd, WND_SCROLLBAR_INDEX, f->output_data.w32->vertical_scroll_bar_extra); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3443 SetWindowLong (hwnd, WND_BACKGROUND_INDEX, FRAME_BACKGROUND_PIXEL (f)); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3444 |
21884 | 3445 /* Enable drag-n-drop. */ |
3446 DragAcceptFiles (hwnd, TRUE); | |
3447 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3448 /* 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
|
3449 ShowWindow (hwnd, SW_HIDE); |
13434 | 3450 } |
3451 } | |
3452 | |
3453 void | |
3454 my_post_msg (wmsg, hwnd, msg, wParam, lParam) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3455 W32Msg * wmsg; |
13434 | 3456 HWND hwnd; |
3457 UINT msg; | |
3458 WPARAM wParam; | |
3459 LPARAM lParam; | |
3460 { | |
3461 wmsg->msg.hwnd = hwnd; | |
3462 wmsg->msg.message = msg; | |
3463 wmsg->msg.wParam = wParam; | |
3464 wmsg->msg.lParam = lParam; | |
3465 wmsg->msg.time = GetMessageTime (); | |
3466 | |
3467 post_msg (wmsg); | |
3468 } | |
3469 | |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
3470 /* GetKeyState and MapVirtualKey on Windows 95 do not actually distinguish |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3471 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
|
3472 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
|
3473 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
|
3474 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
|
3475 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
|
3476 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
|
3477 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
|
3478 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
|
3479 on Swedish keyboards). */ |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3480 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3481 #define EMACS_LCONTROL 0 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3482 #define EMACS_RCONTROL 1 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3483 #define EMACS_LMENU 2 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3484 #define EMACS_RMENU 3 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3485 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3486 static int modifiers[4]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3487 static int modifiers_recorded; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3488 static int modifier_key_support_tested; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3489 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3490 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3491 test_modifier_support (unsigned int wparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3492 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3493 unsigned int l, r; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3494 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3495 if (wparam != VK_CONTROL && wparam != VK_MENU) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3496 return; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3497 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3498 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3499 l = VK_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3500 r = VK_RCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3501 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3502 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3503 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3504 l = VK_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3505 r = VK_RMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3506 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3507 if (!(GetKeyState (l) & 0x8000) && !(GetKeyState (r) & 0x8000)) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3508 modifiers_recorded = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3509 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3510 modifiers_recorded = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3511 modifier_key_support_tested = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3512 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3513 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3514 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3515 record_keydown (unsigned int wparam, unsigned int lparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3516 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3517 int i; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3518 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3519 if (!modifier_key_support_tested) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3520 test_modifier_support (wparam); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3521 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3522 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
|
3523 return; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3524 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3525 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3526 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3527 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3528 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3529 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3530 modifiers[i] = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3531 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3532 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3533 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3534 record_keyup (unsigned int wparam, unsigned int lparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3535 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3536 int i; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3537 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3538 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
|
3539 return; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3540 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3541 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3542 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3543 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3544 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3545 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3546 modifiers[i] = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3547 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3548 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3549 /* 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
|
3550 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
|
3551 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
|
3552 static void |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3553 reset_modifiers () |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3554 { |
15314
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3555 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
|
3556 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3557 if (GetFocus () == NULL) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3558 /* Emacs doesn't have keyboard focus. Do nothing. */ |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3559 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
|
3560 |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3561 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
|
3562 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
|
3563 |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3564 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
|
3565 /* 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
|
3566 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
|
3567 |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3568 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
|
3569 /* 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
|
3570 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
|
3571 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3572 /* Update the state of all modifier keys, because modifiers used in |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3573 hot-key combinations can get stuck on if Emacs loses focus as a |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3574 result of a hot-key being pressed. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3575 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3576 BYTE keystate[256]; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3577 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3578 #define CURRENT_STATE(key) ((GetAsyncKeyState (key) & 0x8000) >> 8) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3579 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3580 GetKeyboardState (keystate); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3581 keystate[VK_SHIFT] = CURRENT_STATE (VK_SHIFT); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3582 keystate[VK_CONTROL] = CURRENT_STATE (VK_CONTROL); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3583 keystate[VK_LCONTROL] = CURRENT_STATE (VK_LCONTROL); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3584 keystate[VK_RCONTROL] = CURRENT_STATE (VK_RCONTROL); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3585 keystate[VK_MENU] = CURRENT_STATE (VK_MENU); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3586 keystate[VK_LMENU] = CURRENT_STATE (VK_LMENU); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3587 keystate[VK_RMENU] = CURRENT_STATE (VK_RMENU); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3588 keystate[VK_LWIN] = CURRENT_STATE (VK_LWIN); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3589 keystate[VK_RWIN] = CURRENT_STATE (VK_RWIN); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3590 keystate[VK_APPS] = CURRENT_STATE (VK_APPS); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3591 SetKeyboardState (keystate); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3592 } |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3593 } |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3594 |
15377
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3595 /* 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
|
3596 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
|
3597 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
|
3598 the left or right modifier should be set. */ |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3599 static void |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3600 sync_modifiers () |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3601 { |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3602 if (!modifiers_recorded) |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3603 return; |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3604 |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3605 if (!(GetKeyState (VK_CONTROL) & 0x8000)) |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3606 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0; |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3607 |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3608 if (!(GetKeyState (VK_MENU) & 0x8000)) |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3609 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0; |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3610 } |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3611 |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3612 static int |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3613 modifier_set (int vkey) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3614 { |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3615 if (vkey == VK_CAPITAL || vkey == VK_SCROLL) |
15280
f39684fddaff
(modifier_set): Check toggle state of CapsLock even
Karl Heuer <kwzh@gnu.org>
parents:
15232
diff
changeset
|
3616 return (GetKeyState (vkey) & 0x1); |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3617 if (!modifiers_recorded) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3618 return (GetKeyState (vkey) & 0x8000); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3619 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3620 switch (vkey) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3621 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3622 case VK_LCONTROL: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3623 return modifiers[EMACS_LCONTROL]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3624 case VK_RCONTROL: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3625 return modifiers[EMACS_RCONTROL]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3626 case VK_LMENU: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3627 return modifiers[EMACS_LMENU]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3628 case VK_RMENU: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3629 return modifiers[EMACS_RMENU]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3630 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3631 return (GetKeyState (vkey) & 0x8000); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3632 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3633 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3634 /* Convert between the modifier bits W32 uses and the modifier bits |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3635 Emacs uses. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3636 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3637 unsigned int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3638 w32_key_to_modifier (int key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3639 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3640 Lisp_Object key_mapping; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3641 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3642 switch (key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3643 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3644 case VK_LWIN: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3645 key_mapping = Vw32_lwindow_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3646 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3647 case VK_RWIN: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3648 key_mapping = Vw32_rwindow_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3649 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3650 case VK_APPS: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3651 key_mapping = Vw32_apps_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3652 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3653 case VK_SCROLL: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3654 key_mapping = Vw32_scroll_lock_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3655 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3656 default: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3657 key_mapping = Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3658 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3659 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3660 /* NB. This code runs in the input thread, asychronously to the lisp |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3661 thread, so we must be careful to ensure access to lisp data is |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3662 thread-safe. The following code is safe because the modifier |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3663 variable values are updated atomically from lisp and symbols are |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3664 not relocated by GC. Also, we don't have to worry about seeing GC |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3665 markbits here. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3666 if (EQ (key_mapping, Qhyper)) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3667 return hyper_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3668 if (EQ (key_mapping, Qsuper)) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3669 return super_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3670 if (EQ (key_mapping, Qmeta)) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3671 return meta_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3672 if (EQ (key_mapping, Qalt)) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3673 return alt_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3674 if (EQ (key_mapping, Qctrl)) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3675 return ctrl_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3676 if (EQ (key_mapping, Qcontrol)) /* synonym for ctrl */ |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3677 return ctrl_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3678 if (EQ (key_mapping, Qshift)) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3679 return shift_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3680 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3681 /* Don't generate any modifier if not explicitly requested. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3682 return 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3683 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3684 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3685 unsigned int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3686 w32_get_modifiers () |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3687 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3688 return ((modifier_set (VK_SHIFT) ? shift_modifier : 0) | |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3689 (modifier_set (VK_CONTROL) ? ctrl_modifier : 0) | |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3690 (modifier_set (VK_LWIN) ? w32_key_to_modifier (VK_LWIN) : 0) | |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3691 (modifier_set (VK_RWIN) ? w32_key_to_modifier (VK_RWIN) : 0) | |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3692 (modifier_set (VK_APPS) ? w32_key_to_modifier (VK_APPS) : 0) | |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3693 (modifier_set (VK_SCROLL) ? w32_key_to_modifier (VK_SCROLL) : 0) | |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3694 (modifier_set (VK_MENU) ? |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3695 ((NILP (Vw32_alt_is_meta)) ? alt_modifier : meta_modifier) : 0)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3696 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3697 |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3698 /* 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
|
3699 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
|
3700 and window input. */ |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3701 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3702 static int |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3703 construct_console_modifiers () |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3704 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3705 int mods; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3706 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3707 mods = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3708 mods |= (modifier_set (VK_SHIFT)) ? SHIFT_PRESSED : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3709 mods |= (modifier_set (VK_CAPITAL)) ? CAPSLOCK_ON : 0; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3710 mods |= (modifier_set (VK_SCROLL)) ? SCROLLLOCK_ON : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3711 mods |= (modifier_set (VK_NUMLOCK)) ? NUMLOCK_ON : 0; |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3712 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
|
3713 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
|
3714 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
|
3715 mods |= (modifier_set (VK_RMENU)) ? RIGHT_ALT_PRESSED : 0; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3716 mods |= (modifier_set (VK_LWIN)) ? LEFT_WIN_PRESSED : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3717 mods |= (modifier_set (VK_RWIN)) ? RIGHT_WIN_PRESSED : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3718 mods |= (modifier_set (VK_APPS)) ? APPS_PRESSED : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3719 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3720 return mods; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3721 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3722 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3723 static int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3724 w32_get_key_modifiers (unsigned int wparam, unsigned int lparam) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3725 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3726 int mods; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3727 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3728 /* Convert to emacs modifiers. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3729 mods = w32_kbd_mods_to_emacs (construct_console_modifiers (), wparam); |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3730 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3731 return mods; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3732 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3733 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3734 unsigned int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3735 map_keypad_keys (unsigned int virt_key, unsigned int extended) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3736 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3737 if (virt_key < VK_CLEAR || virt_key > VK_DELETE) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3738 return virt_key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3739 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3740 if (virt_key == VK_RETURN) |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3741 return (extended ? VK_NUMPAD_ENTER : VK_RETURN); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3742 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3743 if (virt_key >= VK_PRIOR && virt_key <= VK_DOWN) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3744 return (!extended ? (VK_NUMPAD_PRIOR + (virt_key - VK_PRIOR)) : virt_key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3745 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3746 if (virt_key == VK_INSERT || virt_key == VK_DELETE) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3747 return (!extended ? (VK_NUMPAD_INSERT + (virt_key - VK_INSERT)) : virt_key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3748 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3749 if (virt_key == VK_CLEAR) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3750 return (!extended ? VK_NUMPAD_CLEAR : virt_key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3751 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3752 return virt_key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3753 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3754 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3755 /* List of special key combinations which w32 would normally capture, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3756 but emacs should grab instead. Not directly visible to lisp, to |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3757 simplify synchronization. Each item is an integer encoding a virtual |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3758 key code and modifier combination to capture. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3759 Lisp_Object w32_grabbed_keys; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3760 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3761 #define HOTKEY(vk,mods) make_number (((vk) & 255) | ((mods) << 8)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3762 #define HOTKEY_ID(k) (XFASTINT (k) & 0xbfff) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3763 #define HOTKEY_VK_CODE(k) (XFASTINT (k) & 255) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3764 #define HOTKEY_MODIFIERS(k) (XFASTINT (k) >> 8) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3765 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3766 /* Register hot-keys for reserved key combinations when Emacs has |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3767 keyboard focus, since this is the only way Emacs can receive key |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3768 combinations like Alt-Tab which are used by the system. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3769 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3770 static void |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3771 register_hot_keys (hwnd) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3772 HWND hwnd; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3773 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3774 Lisp_Object keylist; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3775 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3776 /* Use GC_CONSP, since we are called asynchronously. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3777 for (keylist = w32_grabbed_keys; GC_CONSP (keylist); keylist = XCDR (keylist)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3778 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3779 Lisp_Object key = XCAR (keylist); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3780 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3781 /* Deleted entries get set to nil. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3782 if (!INTEGERP (key)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3783 continue; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3784 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3785 RegisterHotKey (hwnd, HOTKEY_ID (key), |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3786 HOTKEY_MODIFIERS (key), HOTKEY_VK_CODE (key)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3787 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3788 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3789 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3790 static void |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3791 unregister_hot_keys (hwnd) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3792 HWND hwnd; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3793 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3794 Lisp_Object keylist; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3795 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3796 /* Use GC_CONSP, since we are called asynchronously. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3797 for (keylist = w32_grabbed_keys; GC_CONSP (keylist); keylist = XCDR (keylist)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3798 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3799 Lisp_Object key = XCAR (keylist); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3800 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3801 if (!INTEGERP (key)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3802 continue; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3803 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3804 UnregisterHotKey (hwnd, HOTKEY_ID (key)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3805 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3806 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3807 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3808 /* Main message dispatch loop. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3809 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3810 static void |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3811 w32_msg_pump (deferred_msg * msg_buf) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3812 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3813 MSG msg; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3814 int result; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3815 HWND focus_window; |
21874
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
3816 |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
3817 msh_mousewheel = RegisterWindowMessage (MSH_MOUSEWHEEL); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3818 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3819 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
|
3820 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3821 if (msg.hwnd == NULL) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3822 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3823 switch (msg.message) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3824 { |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3825 case WM_NULL: |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3826 /* Produced by complete_deferred_msg; just ignore. */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3827 break; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3828 case WM_EMACS_CREATEWINDOW: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3829 w32_createwindow ((struct frame *) msg.wParam); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3830 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3831 abort (); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3832 break; |
21608
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3833 case WM_EMACS_SETLOCALE: |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3834 SetThreadLocale (msg.wParam); |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3835 /* Reply is not expected. */ |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3836 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3837 case WM_EMACS_SETKEYBOARDLAYOUT: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3838 result = (int) ActivateKeyboardLayout ((HKL) msg.wParam, 0); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3839 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3840 result, 0)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3841 abort (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3842 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3843 case WM_EMACS_REGISTER_HOT_KEY: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3844 focus_window = GetFocus (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3845 if (focus_window != NULL) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3846 RegisterHotKey (focus_window, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3847 HOTKEY_ID (msg.wParam), |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3848 HOTKEY_MODIFIERS (msg.wParam), |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3849 HOTKEY_VK_CODE (msg.wParam)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3850 /* Reply is not expected. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3851 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3852 case WM_EMACS_UNREGISTER_HOT_KEY: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3853 focus_window = GetFocus (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3854 if (focus_window != NULL) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3855 UnregisterHotKey (focus_window, HOTKEY_ID (msg.wParam)); |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3856 /* Mark item as erased. NB: this code must be |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3857 thread-safe. The next line is okay because the cons |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3858 cell is never made into garbage and is not relocated by |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3859 GC. */ |
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
39812
diff
changeset
|
3860 XSETCAR ((Lisp_Object) msg.lParam, Qnil); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3861 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3862 abort (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3863 break; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3864 case WM_EMACS_TOGGLE_LOCK_KEY: |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3865 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3866 int vk_code = (int) msg.wParam; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3867 int cur_state = (GetKeyState (vk_code) & 1); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3868 Lisp_Object new_state = (Lisp_Object) msg.lParam; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3869 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3870 /* NB: This code must be thread-safe. It is safe to |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3871 call NILP because symbols are not relocated by GC, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3872 and pointer here is not touched by GC (so the markbit |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3873 can't be set). Numbers are safe because they are |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3874 immediate values. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3875 if (NILP (new_state) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3876 || (NUMBERP (new_state) |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
3877 && ((XUINT (new_state)) & 1) != cur_state)) |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3878 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3879 one_w32_display_info.faked_key = vk_code; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3880 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3881 keybd_event ((BYTE) vk_code, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3882 (BYTE) MapVirtualKey (vk_code, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3883 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3884 keybd_event ((BYTE) vk_code, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3885 (BYTE) MapVirtualKey (vk_code, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3886 KEYEVENTF_EXTENDEDKEY | 0, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3887 keybd_event ((BYTE) vk_code, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3888 (BYTE) MapVirtualKey (vk_code, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3889 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3890 cur_state = !cur_state; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3891 } |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3892 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3893 cur_state, 0)) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3894 abort (); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3895 } |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3896 break; |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3897 default: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3898 DebPrint (("msg %x not expected by w32_msg_pump\n", msg.message)); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3899 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3900 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3901 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3902 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3903 DispatchMessage (&msg); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3904 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3905 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3906 /* Exit nested loop when our deferred message has completed. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3907 if (msg_buf->completed) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3908 break; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3909 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3910 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3911 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3912 deferred_msg * deferred_msg_head; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3913 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3914 static deferred_msg * |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3915 find_deferred_msg (HWND hwnd, UINT msg) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3916 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3917 deferred_msg * item; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3918 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3919 /* Don't actually need synchronization for read access, since |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3920 modification of single pointer is always atomic. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3921 /* enter_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3922 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3923 for (item = deferred_msg_head; item != NULL; item = item->next) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3924 if (item->w32msg.msg.hwnd == hwnd |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3925 && item->w32msg.msg.message == msg) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3926 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3927 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3928 /* leave_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3929 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3930 return item; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3931 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3932 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3933 static LRESULT |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3934 send_deferred_msg (deferred_msg * msg_buf, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3935 HWND hwnd, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3936 UINT msg, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3937 WPARAM wParam, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3938 LPARAM lParam) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3939 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3940 /* Only input thread can send deferred messages. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3941 if (GetCurrentThreadId () != dwWindowsThreadId) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3942 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3943 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3944 /* It is an error to send a message that is already deferred. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3945 if (find_deferred_msg (hwnd, msg) != NULL) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3946 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3947 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3948 /* Enforced synchronization is not needed because this is the only |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3949 function that alters deferred_msg_head, and the following critical |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3950 section is guaranteed to only be serially reentered (since only the |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3951 input thread can call us). */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3952 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3953 /* enter_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3954 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3955 msg_buf->completed = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3956 msg_buf->next = deferred_msg_head; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3957 deferred_msg_head = msg_buf; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3958 my_post_msg (&msg_buf->w32msg, hwnd, msg, wParam, lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3959 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3960 /* leave_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3961 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3962 /* Start a new nested message loop to process other messages until |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3963 this one is completed. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3964 w32_msg_pump (msg_buf); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3965 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3966 deferred_msg_head = msg_buf->next; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3967 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3968 return msg_buf->result; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3969 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3970 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3971 void |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3972 complete_deferred_msg (HWND hwnd, UINT msg, LRESULT result) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3973 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3974 deferred_msg * msg_buf = find_deferred_msg (hwnd, msg); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3975 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3976 if (msg_buf == NULL) |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3977 /* Message may have been cancelled, so don't abort(). */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3978 return; |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3979 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3980 msg_buf->result = result; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3981 msg_buf->completed = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3982 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3983 /* Ensure input thread is woken so it notices the completion. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3984 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3985 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3986 |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3987 void |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3988 cancel_all_deferred_msgs () |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3989 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3990 deferred_msg * item; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3991 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3992 /* Don't actually need synchronization for read access, since |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3993 modification of single pointer is always atomic. */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3994 /* enter_crit (); */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3995 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3996 for (item = deferred_msg_head; item != NULL; item = item->next) |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3997 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3998 item->result = 0; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3999 item->completed = 1; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4000 } |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4001 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4002 /* leave_crit (); */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4003 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4004 /* Ensure input thread is woken so it notices the completion. */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4005 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0); |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4006 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4007 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4008 DWORD |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4009 w32_msg_worker (dw) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4010 DWORD dw; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4011 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4012 MSG msg; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4013 deferred_msg dummy_buf; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4014 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4015 /* Ensure our message queue is created */ |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4016 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4017 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4018 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4019 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4020 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4021 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4022 memset (&dummy_buf, 0, sizeof (dummy_buf)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4023 dummy_buf.w32msg.msg.hwnd = NULL; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4024 dummy_buf.w32msg.msg.message = WM_NULL; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4025 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4026 /* This is the inital message loop which should only exit when the |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4027 application quits. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4028 w32_msg_pump (&dummy_buf); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4029 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4030 return 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4031 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4032 |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4033 static void |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4034 post_character_message (hwnd, msg, wParam, lParam, modifiers) |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4035 HWND hwnd; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4036 UINT msg; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4037 WPARAM wParam; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4038 LPARAM lParam; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4039 DWORD modifiers; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4040 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4041 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4042 W32Msg wmsg; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4043 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4044 wmsg.dwModifiers = modifiers; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4045 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4046 /* Detect quit_char and set quit-flag directly. Note that we |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4047 still need to post a message to ensure the main thread will be |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4048 woken up if blocked in sys_select(), but we do NOT want to post |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4049 the quit_char message itself (because it will usually be as if |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4050 the user had typed quit_char twice). Instead, we post a dummy |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4051 message that has no particular effect. */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4052 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4053 int c = wParam; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4054 if (isalpha (c) && wmsg.dwModifiers == ctrl_modifier) |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4055 c = make_ctrl_char (c) & 0377; |
24339
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
4056 if (c == quit_char |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
4057 || (wmsg.dwModifiers == 0 && |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
4058 XFASTINT (Vw32_quit_key) && wParam == XFASTINT (Vw32_quit_key))) |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4059 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4060 Vquit_flag = Qt; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4061 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4062 /* The choice of message is somewhat arbitrary, as long as |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4063 the main thread handler just ignores it. */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4064 msg = WM_NULL; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4065 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4066 /* Interrupt any blocking system calls. */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4067 signal_quit (); |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4068 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4069 /* As a safety precaution, forcibly complete any deferred |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4070 messages. This is a kludge, but I don't see any particularly |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4071 clean way to handle the situation where a deferred message is |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4072 "dropped" in the lisp thread, and will thus never be |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4073 completed, eg. by the user trying to activate the menubar |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4074 when the lisp thread is busy, and then typing C-g when the |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4075 menubar doesn't open promptly (with the result that the |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4076 menubar never responds at all because the deferred |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4077 WM_INITMENU message is never completed). Another problem |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4078 situation is when the lisp thread calls SendMessage (to send |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4079 a window manager command) when a message has been deferred; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4080 the lisp thread gets blocked indefinitely waiting for the |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4081 deferred message to be completed, which itself is waiting for |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4082 the lisp thread to respond. |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4083 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4084 Note that we don't want to block the input thread waiting for |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4085 a reponse from the lisp thread (although that would at least |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4086 solve the deadlock problem above), because we want to be able |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4087 to receive C-g to interrupt the lisp thread. */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4088 cancel_all_deferred_msgs (); |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4089 } |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4090 } |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4091 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4092 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4093 } |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4094 |
13434 | 4095 /* Main window procedure */ |
4096 | |
4097 LRESULT CALLBACK | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4098 w32_wnd_proc (hwnd, msg, wParam, lParam) |
13434 | 4099 HWND hwnd; |
4100 UINT msg; | |
4101 WPARAM wParam; | |
4102 LPARAM lParam; | |
4103 { | |
4104 struct frame *f; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4105 struct w32_display_info *dpyinfo = &one_w32_display_info; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4106 W32Msg wmsg; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4107 int windows_translate; |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4108 int key; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4109 |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4110 /* 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
|
4111 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
|
4112 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
|
4113 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
|
4114 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
|
4115 |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4116 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
|
4117 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
|
4118 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
|
4119 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
|
4120 delete-frame has synchronized with this thread. |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4121 |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4122 It is also safe to use functions that make GDI calls, such as |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4123 w32_clear_rect, because these functions must obtain a DC handle |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4124 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
|
4125 |
13434 | 4126 switch (msg) |
4127 { | |
4128 case WM_ERASEBKGND: | |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4129 f = x_window_to_frame (dpyinfo, hwnd); |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4130 if (f) |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4131 { |
27407
7df920562cbe
(w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents:
27397
diff
changeset
|
4132 HDC hdc = get_frame_dc (f); |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4133 GetUpdateRect (hwnd, &wmsg.rect, FALSE); |
27407
7df920562cbe
(w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents:
27397
diff
changeset
|
4134 w32_clear_rect (f, hdc, &wmsg.rect); |
7df920562cbe
(w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents:
27397
diff
changeset
|
4135 release_frame_dc (f, hdc); |
24718
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4136 |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4137 #if defined (W32_DEBUG_DISPLAY) |
39128
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4138 DebPrint (("WM_ERASEBKGND (frame %p): erasing %d,%d-%d,%d\n", |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4139 f, |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4140 wmsg.rect.left, wmsg.rect.top, |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4141 wmsg.rect.right, wmsg.rect.bottom)); |
24718
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4142 #endif /* W32_DEBUG_DISPLAY */ |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4143 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4144 return 1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4145 case WM_PALETTECHANGED: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4146 /* ignore our own changes */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4147 if ((HWND)wParam != hwnd) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4148 { |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4149 f = x_window_to_frame (dpyinfo, hwnd); |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4150 if (f) |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4151 /* 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
|
4152 frames to be redrawn if needed. */ |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4153 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
|
4154 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4155 return 0; |
13434 | 4156 case WM_PAINT: |
24718
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4157 { |
24670 | 4158 PAINTSTRUCT paintStruct; |
4159 RECT update_rect; | |
42935
20a21fb23284
(w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
Jason Rumney <jasonr@gnu.org>
parents:
42918
diff
changeset
|
4160 bzero (&update_rect, sizeof (update_rect)); |
24670 | 4161 |
39128
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4162 f = x_window_to_frame (dpyinfo, hwnd); |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4163 if (f == 0) |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4164 { |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4165 DebPrint (("WM_PAINT received for unknown window %p\n", hwnd)); |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4166 return 0; |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4167 } |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4168 |
24670 | 4169 /* MSDN Docs say not to call BeginPaint if GetUpdateRect |
4170 fails. Apparently this can happen under some | |
4171 circumstances. */ | |
42935
20a21fb23284
(w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
Jason Rumney <jasonr@gnu.org>
parents:
42918
diff
changeset
|
4172 if (GetUpdateRect (hwnd, &update_rect, FALSE) || !w32_strict_painting) |
24670 | 4173 { |
4174 enter_crit (); | |
4175 BeginPaint (hwnd, &paintStruct); | |
4176 | |
42935
20a21fb23284
(w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
Jason Rumney <jasonr@gnu.org>
parents:
42918
diff
changeset
|
4177 /* The rectangles returned by GetUpdateRect and BeginPaint |
20a21fb23284
(w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
Jason Rumney <jasonr@gnu.org>
parents:
42918
diff
changeset
|
4178 do not always match. Play it safe by assuming both areas |
20a21fb23284
(w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
Jason Rumney <jasonr@gnu.org>
parents:
42918
diff
changeset
|
4179 are invalid. */ |
20a21fb23284
(w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
Jason Rumney <jasonr@gnu.org>
parents:
42918
diff
changeset
|
4180 UnionRect (&(wmsg.rect), &update_rect, &(paintStruct.rcPaint)); |
24670 | 4181 |
4182 #if defined (W32_DEBUG_DISPLAY) | |
39128
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4183 DebPrint (("WM_PAINT (frame %p): painting %d,%d-%d,%d\n", |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4184 f, |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4185 wmsg.rect.left, wmsg.rect.top, |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4186 wmsg.rect.right, wmsg.rect.bottom)); |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4187 DebPrint ((" [update region is %d,%d-%d,%d]\n", |
24670 | 4188 update_rect.left, update_rect.top, |
4189 update_rect.right, update_rect.bottom)); | |
4190 #endif | |
4191 EndPaint (hwnd, &paintStruct); | |
4192 leave_crit (); | |
4193 | |
4194 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); | |
4195 | |
4196 return 0; | |
4197 } | |
24695
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
4198 |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
4199 /* If GetUpdateRect returns 0 (meaning there is no update |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
4200 region), assume the whole window needs to be repainted. */ |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
4201 GetClientRect(hwnd, &wmsg.rect); |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
4202 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
4203 return 0; |
13434 | 4204 } |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4205 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4206 case WM_INPUTLANGCHANGE: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4207 /* Inform lisp thread of keyboard layout changes. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4208 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4209 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4210 /* Clear dead keys in the keyboard state; for simplicity only |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4211 preserve modifier key states. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4212 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4213 int i; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4214 BYTE keystate[256]; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4215 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4216 GetKeyboardState (keystate); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4217 for (i = 0; i < 256; i++) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4218 if (1 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4219 && i != VK_SHIFT |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4220 && i != VK_LSHIFT |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4221 && i != VK_RSHIFT |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4222 && i != VK_CAPITAL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4223 && i != VK_NUMLOCK |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4224 && i != VK_SCROLL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4225 && i != VK_CONTROL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4226 && i != VK_LCONTROL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4227 && i != VK_RCONTROL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4228 && i != VK_MENU |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4229 && i != VK_LMENU |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4230 && i != VK_RMENU |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4231 && i != VK_LWIN |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4232 && i != VK_RWIN) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4233 keystate[i] = 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4234 SetKeyboardState (keystate); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4235 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4236 goto dflt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4237 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4238 case WM_HOTKEY: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4239 /* Synchronize hot keys with normal input. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4240 PostMessage (hwnd, WM_KEYDOWN, HIWORD (lParam), 0); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4241 return (0); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4242 |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4243 case WM_KEYUP: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4244 case WM_SYSKEYUP: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4245 record_keyup (wParam, lParam); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4246 goto dflt; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4247 |
13434 | 4248 case WM_KEYDOWN: |
4249 case WM_SYSKEYDOWN: | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4250 /* Ignore keystrokes we fake ourself; see below. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4251 if (dpyinfo->faked_key == wParam) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4252 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4253 dpyinfo->faked_key = 0; |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4254 /* Make sure TranslateMessage sees them though (as long as |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4255 they don't produce WM_CHAR messages). This ensures that |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4256 indicator lights are toggled promptly on Windows 9x, for |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4257 example. */ |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4258 if (lispy_function_keys[wParam] != 0) |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4259 { |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4260 windows_translate = 1; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4261 goto translate; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4262 } |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4263 return 0; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4264 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4265 |
15377
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
4266 /* Synchronize modifiers with current keystroke. */ |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
4267 sync_modifiers (); |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4268 record_keydown (wParam, lParam); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4269 wParam = map_keypad_keys (wParam, (lParam & 0x1000000L) != 0); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4270 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4271 windows_translate = 0; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4272 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4273 switch (wParam) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4274 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4275 case VK_LWIN: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4276 if (NILP (Vw32_pass_lwindow_to_system)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4277 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4278 /* Prevent system from acting on keyup (which opens the |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4279 Start menu if no other key was pressed) by simulating a |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4280 press of Space which we will ignore. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4281 if (GetAsyncKeyState (wParam) & 1) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4282 { |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4283 if (NUMBERP (Vw32_phantom_key_code)) |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4284 key = XUINT (Vw32_phantom_key_code) & 255; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4285 else |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4286 key = VK_SPACE; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4287 dpyinfo->faked_key = key; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4288 keybd_event (key, (BYTE) MapVirtualKey (key, 0), 0, 0); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4289 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4290 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4291 if (!NILP (Vw32_lwindow_modifier)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4292 return 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4293 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4294 case VK_RWIN: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4295 if (NILP (Vw32_pass_rwindow_to_system)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4296 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4297 if (GetAsyncKeyState (wParam) & 1) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4298 { |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4299 if (NUMBERP (Vw32_phantom_key_code)) |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4300 key = XUINT (Vw32_phantom_key_code) & 255; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4301 else |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4302 key = VK_SPACE; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4303 dpyinfo->faked_key = key; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4304 keybd_event (key, (BYTE) MapVirtualKey (key, 0), 0, 0); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4305 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4306 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4307 if (!NILP (Vw32_rwindow_modifier)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4308 return 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4309 break; |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4310 case VK_APPS: |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4311 if (!NILP (Vw32_apps_modifier)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4312 return 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4313 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4314 case VK_MENU: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4315 if (NILP (Vw32_pass_alt_to_system)) |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4316 /* Prevent DefWindowProc from activating the menu bar if an |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4317 Alt key is pressed and released by itself. */ |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4318 return 0; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4319 windows_translate = 1; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4320 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4321 case VK_CAPITAL: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4322 /* Decide whether to treat as modifier or function key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4323 if (NILP (Vw32_enable_caps_lock)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4324 goto disable_lock_key; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4325 windows_translate = 1; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4326 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4327 case VK_NUMLOCK: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4328 /* Decide whether to treat as modifier or function key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4329 if (NILP (Vw32_enable_num_lock)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4330 goto disable_lock_key; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4331 windows_translate = 1; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4332 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4333 case VK_SCROLL: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4334 /* Decide whether to treat as modifier or function key. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4335 if (NILP (Vw32_scroll_lock_modifier)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4336 goto disable_lock_key; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4337 windows_translate = 1; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4338 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4339 disable_lock_key: |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4340 /* Ensure the appropriate lock key state (and indicator light) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4341 remains in the same state. We do this by faking another |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4342 press of the relevant key. Apparently, this really is the |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4343 only way to toggle the state of the indicator lights. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4344 dpyinfo->faked_key = wParam; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4345 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4346 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4347 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4348 KEYEVENTF_EXTENDEDKEY | 0, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4349 keybd_event ((BYTE) wParam, (BYTE) MapVirtualKey (wParam, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4350 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4351 /* Ensure indicator lights are updated promptly on Windows 9x |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4352 (TranslateMessage apparently does this), after forwarding |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4353 input event. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4354 post_character_message (hwnd, msg, wParam, lParam, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4355 w32_get_key_modifiers (wParam, lParam)); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4356 windows_translate = 1; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4357 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4358 case VK_CONTROL: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4359 case VK_SHIFT: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4360 case VK_PROCESSKEY: /* Generated by IME. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4361 windows_translate = 1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4362 break; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4363 case VK_CANCEL: |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4364 /* Windows maps Ctrl-Pause (aka Ctrl-Break) into VK_CANCEL, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4365 which is confusing for purposes of key binding; convert |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4366 VK_CANCEL events into VK_PAUSE events. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4367 wParam = VK_PAUSE; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4368 break; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4369 case VK_PAUSE: |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4370 /* Windows maps Ctrl-NumLock into VK_PAUSE, which is confusing |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4371 for purposes of key binding; convert these back into |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4372 VK_NUMLOCK events, at least when we want to see NumLock key |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4373 presses. (Note that there is never any possibility that |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4374 VK_PAUSE with Ctrl really is C-Pause as per above.) */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4375 if (NILP (Vw32_enable_num_lock) && modifier_set (VK_CONTROL)) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4376 wParam = VK_NUMLOCK; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4377 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4378 default: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4379 /* If not defined as a function key, change it to a WM_CHAR message. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4380 if (lispy_function_keys[wParam] == 0) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4381 { |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4382 DWORD modifiers = construct_console_modifiers (); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4383 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4384 if (!NILP (Vw32_recognize_altgr) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4385 && modifier_set (VK_LCONTROL) && modifier_set (VK_RMENU)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4386 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4387 /* Always let TranslateMessage handle AltGr key chords; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4388 for some reason, ToAscii doesn't always process AltGr |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4389 chords correctly. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4390 windows_translate = 1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4391 } |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4392 else if ((modifiers & (~SHIFT_PRESSED & ~CAPSLOCK_ON)) != 0) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4393 { |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4394 /* Handle key chords including any modifiers other |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4395 than shift directly, in order to preserve as much |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4396 modifier information as possible. */ |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4397 if ('A' <= wParam && wParam <= 'Z') |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4398 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4399 /* Don't translate modified alphabetic keystrokes, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4400 so the user doesn't need to constantly switch |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4401 layout to type control or meta keystrokes when |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4402 the normal layout translates alphabetic |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4403 characters to non-ascii characters. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4404 if (!modifier_set (VK_SHIFT)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4405 wParam += ('a' - 'A'); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4406 msg = WM_CHAR; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4407 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4408 else |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4409 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4410 /* Try to handle other keystrokes by determining the |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4411 base character (ie. translating the base key plus |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4412 shift modifier). */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4413 int add; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4414 int isdead = 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4415 KEY_EVENT_RECORD key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4416 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4417 key.bKeyDown = TRUE; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4418 key.wRepeatCount = 1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4419 key.wVirtualKeyCode = wParam; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4420 key.wVirtualScanCode = (lParam & 0xFF0000) >> 16; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4421 key.uChar.AsciiChar = 0; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4422 key.dwControlKeyState = modifiers; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4423 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4424 add = w32_kbd_patch_key (&key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4425 /* 0 means an unrecognised keycode, negative means |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4426 dead key. Ignore both. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4427 while (--add >= 0) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4428 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4429 /* Forward asciified character sequence. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4430 post_character_message |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4431 (hwnd, WM_CHAR, key.uChar.AsciiChar, lParam, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4432 w32_get_key_modifiers (wParam, lParam)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4433 w32_kbd_patch_key (&key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4434 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4435 return 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4436 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4437 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4438 else |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4439 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4440 /* Let TranslateMessage handle everything else. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4441 windows_translate = 1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4442 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4443 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4444 } |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4445 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4446 translate: |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4447 if (windows_translate) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4448 { |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
4449 MSG windows_msg = { hwnd, msg, wParam, lParam, 0, {0,0} }; |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
4450 |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
4451 windows_msg.time = GetMessageTime (); |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
4452 TranslateMessage (&windows_msg); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4453 goto dflt; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4454 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4455 |
13434 | 4456 /* Fall through */ |
4457 | |
4458 case WM_SYSCHAR: | |
4459 case WM_CHAR: | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4460 post_character_message (hwnd, msg, wParam, lParam, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4461 w32_get_key_modifiers (wParam, lParam)); |
13434 | 4462 break; |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4463 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4464 /* 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
|
4465 are used together, but only if user has two button mouse. */ |
13434 | 4466 case WM_LBUTTONDOWN: |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4467 case WM_RBUTTONDOWN: |
27894
6c4ff3519d09
(w32_wnd_proc) [WM_LBUTTON_DOWN, WM_RBUTTON_DOWN, WM_LBUTTON_UP,
Jason Rumney <jasonr@gnu.org>
parents:
27516
diff
changeset
|
4468 if (XINT (Vw32_num_mouse_buttons) > 2) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4469 goto handle_plain_button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4470 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4471 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4472 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
|
4473 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
|
4474 |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4475 if (button_state & this) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4476 return 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4477 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4478 if (button_state == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4479 SetCapture (hwnd); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4480 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4481 button_state |= this; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4482 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4483 if (button_state & other) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4484 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4485 if (mouse_button_timer) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4486 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4487 KillTimer (hwnd, mouse_button_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4488 mouse_button_timer = 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4489 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4490 /* Generate middle mouse event instead. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4491 msg = WM_MBUTTONDOWN; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4492 button_state |= MMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4493 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4494 else if (button_state & MMOUSE) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4495 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4496 /* 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
|
4497 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
|
4498 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
|
4499 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
|
4500 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4501 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4502 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4503 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4504 /* Flush out saved message. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4505 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
|
4506 } |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4507 wmsg.dwModifiers = w32_get_modifiers (); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4508 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
|
4509 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4510 /* Clear message buffer. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4511 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
|
4512 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4513 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4514 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4515 /* Hold onto message for now. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4516 mouse_button_timer = |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4517 SetTimer (hwnd, MOUSE_BUTTON_ID, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4518 XINT (Vw32_mouse_button_tolerance), NULL); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4519 saved_mouse_button_msg.msg.hwnd = hwnd; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4520 saved_mouse_button_msg.msg.message = msg; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4521 saved_mouse_button_msg.msg.wParam = wParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4522 saved_mouse_button_msg.msg.lParam = lParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4523 saved_mouse_button_msg.msg.time = GetMessageTime (); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4524 saved_mouse_button_msg.dwModifiers = w32_get_modifiers (); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4525 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4526 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4527 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4528 |
13434 | 4529 case WM_LBUTTONUP: |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4530 case WM_RBUTTONUP: |
27894
6c4ff3519d09
(w32_wnd_proc) [WM_LBUTTON_DOWN, WM_RBUTTON_DOWN, WM_LBUTTON_UP,
Jason Rumney <jasonr@gnu.org>
parents:
27516
diff
changeset
|
4531 if (XINT (Vw32_num_mouse_buttons) > 2) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4532 goto handle_plain_button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4533 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4534 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4535 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
|
4536 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
|
4537 |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4538 if ((button_state & this) == 0) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4539 return 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4540 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4541 button_state &= ~this; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4542 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4543 if (button_state & MMOUSE) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4544 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4545 /* 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
|
4546 if ((button_state & other) == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4547 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4548 msg = WM_MBUTTONUP; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4549 button_state &= ~MMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4550 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4551 if (button_state) abort (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4552 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4553 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4554 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4555 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4556 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4557 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4558 /* Flush out saved message if necessary. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4559 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
|
4560 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4561 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
|
4562 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4563 } |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4564 wmsg.dwModifiers = w32_get_modifiers (); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4565 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
|
4566 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4567 /* 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
|
4568 saved_mouse_button_msg.msg.hwnd = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4569 KillTimer (hwnd, mouse_button_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4570 mouse_button_timer = 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4571 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4572 if (button_state == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4573 ReleaseCapture (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4574 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4575 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4576 |
42719
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4577 case WM_XBUTTONDOWN: |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4578 case WM_XBUTTONUP: |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4579 if (w32_pass_extra_mouse_buttons_to_system) |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4580 goto dflt; |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4581 /* else fall through and process them. */ |
13434 | 4582 case WM_MBUTTONDOWN: |
4583 case WM_MBUTTONUP: | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4584 handle_plain_button: |
13434 | 4585 { |
4586 BOOL up; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4587 int button; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4588 |
42719
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4589 if (parse_button (msg, HIWORD (wParam), &button, &up)) |
13434 | 4590 { |
4591 if (up) ReleaseCapture (); | |
4592 else SetCapture (hwnd); | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4593 button = (button == 0) ? LMOUSE : |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4594 ((button == 1) ? MMOUSE : RMOUSE); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4595 if (up) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4596 button_state &= ~button; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4597 else |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4598 button_state |= button; |
13434 | 4599 } |
4600 } | |
4601 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4602 wmsg.dwModifiers = w32_get_modifiers (); |
13434 | 4603 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
42719
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4604 |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4605 /* Need to return true for XBUTTON messages, false for others, |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4606 to indicate that we processed the message. */ |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4607 return (msg == WM_XBUTTONDOWN || msg == WM_XBUTTONUP); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4608 |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4609 case WM_MOUSEMOVE: |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4610 /* If the mouse has just moved into the frame, start tracking |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4611 it, so we will be notified when it leaves the frame. Mouse |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4612 tracking only works under W98 and NT4 and later. On earlier |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4613 versions, there is no way of telling when the mouse leaves the |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4614 frame, so we just have to put up with help-echo and mouse |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4615 highlighting remaining while the frame is not active. */ |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4616 if (track_mouse_event_fn && !track_mouse_window) |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4617 { |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4618 TRACKMOUSEEVENT tme; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4619 tme.cbSize = sizeof (tme); |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4620 tme.dwFlags = TME_LEAVE; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4621 tme.hwndTrack = hwnd; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4622 |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4623 track_mouse_event_fn (&tme); |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4624 track_mouse_window = hwnd; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4625 } |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4626 case WM_VSCROLL: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4627 if (XINT (Vw32_mouse_move_interval) <= 0 |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4628 || (msg == WM_MOUSEMOVE && button_state == 0)) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4629 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4630 wmsg.dwModifiers = w32_get_modifiers (); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4631 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
|
4632 return 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4633 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4634 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4635 /* 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
|
4636 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
|
4637 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
|
4638 expires, we just replace the first message. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4639 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4640 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
|
4641 mouse_move_timer = |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4642 SetTimer (hwnd, MOUSE_MOVE_ID, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4643 XINT (Vw32_mouse_move_interval), NULL); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4644 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4645 /* Hold onto message for now. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4646 saved_mouse_move_msg.msg.hwnd = hwnd; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4647 saved_mouse_move_msg.msg.message = msg; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4648 saved_mouse_move_msg.msg.wParam = wParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4649 saved_mouse_move_msg.msg.lParam = lParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4650 saved_mouse_move_msg.msg.time = GetMessageTime (); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4651 saved_mouse_move_msg.dwModifiers = w32_get_modifiers (); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4652 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4653 return 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4654 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4655 case WM_MOUSEWHEEL: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4656 wmsg.dwModifiers = w32_get_modifiers (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4657 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4658 return 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4659 |
21884 | 4660 case WM_DROPFILES: |
4661 wmsg.dwModifiers = w32_get_modifiers (); | |
4662 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); | |
4663 return 0; | |
4664 | |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4665 case WM_TIMER: |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4666 /* Flush out saved messages if necessary. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4667 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
|
4668 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4669 if (saved_mouse_button_msg.msg.hwnd) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4670 { |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4671 post_msg (&saved_mouse_button_msg); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4672 saved_mouse_button_msg.msg.hwnd = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4673 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4674 KillTimer (hwnd, mouse_button_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4675 mouse_button_timer = 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4676 } |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4677 else if (wParam == mouse_move_timer) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4678 { |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4679 if (saved_mouse_move_msg.msg.hwnd) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4680 { |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4681 post_msg (&saved_mouse_move_msg); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4682 saved_mouse_move_msg.msg.hwnd = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4683 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4684 KillTimer (hwnd, mouse_move_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4685 mouse_move_timer = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4686 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4687 return 0; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4688 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4689 case WM_NCACTIVATE: |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4690 /* Windows doesn't send us focus messages when putting up and |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
4691 taking down a system popup dialog as for Ctrl-Alt-Del on Windows 95. |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4692 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
|
4693 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
|
4694 keyboard modifiers' state. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4695 reset_modifiers (); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4696 goto dflt; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4697 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4698 case WM_INITMENU: |
24751
e0eaca5025bc
(w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents:
24718
diff
changeset
|
4699 button_state = 0; |
e0eaca5025bc
(w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents:
24718
diff
changeset
|
4700 ReleaseCapture (); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4701 /* We must ensure menu bar is fully constructed and up to date |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4702 before allowing user interaction with it. To achieve this |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4703 we send this message to the lisp thread and wait for a |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4704 reply (whose value is not actually needed) to indicate that |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4705 the menu bar is now ready for use, so we can now return. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4706 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4707 To remain responsive in the meantime, we enter a nested message |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4708 loop that can process all other messages. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4709 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4710 However, we skip all this if the message results from calling |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4711 TrackPopupMenu - in fact, we must NOT attempt to send the lisp |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4712 thread a message because it is blocked on us at this point. We |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4713 set menubar_active before calling TrackPopupMenu to indicate |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4714 this (there is no possibility of confusion with real menubar |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4715 being active). */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4716 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4717 f = x_window_to_frame (dpyinfo, hwnd); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4718 if (f |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4719 && (f->output_data.w32->menubar_active |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4720 /* We can receive this message even in the absence of a |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4721 menubar (ie. when the system menu is activated) - in this |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4722 case we do NOT want to forward the message, otherwise it |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4723 will cause the menubar to suddenly appear when the user |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4724 had requested it to be turned off! */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4725 || f->output_data.w32->menubar_widget == NULL)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4726 return 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4727 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4728 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4729 deferred_msg msg_buf; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4730 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4731 /* Detect if message has already been deferred; in this case |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4732 we cannot return any sensible value to ignore this. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4733 if (find_deferred_msg (hwnd, msg) != NULL) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4734 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4735 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4736 return send_deferred_msg (&msg_buf, hwnd, msg, wParam, lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4737 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4738 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4739 case WM_EXITMENULOOP: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4740 f = x_window_to_frame (dpyinfo, hwnd); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4741 |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4742 /* Free memory used by owner-drawn and help-echo strings. */ |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4743 w32_free_menu_strings (hwnd); |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4744 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4745 /* Indicate that menubar can be modified again. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4746 if (f) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4747 f->output_data.w32->menubar_active = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4748 goto dflt; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4749 |
28272
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
4750 case WM_MENUSELECT: |
41638
aadcf676d5de
(w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents:
41480
diff
changeset
|
4751 /* Direct handling of help_echo in menus. Should be safe now |
aadcf676d5de
(w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents:
41480
diff
changeset
|
4752 that we generate the help_echo by placing a help event in the |
aadcf676d5de
(w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents:
41480
diff
changeset
|
4753 keyboard buffer. */ |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
4754 { |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
4755 HMENU menu = (HMENU) lParam; |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
4756 UINT menu_item = (UINT) LOWORD (wParam); |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
4757 UINT flags = (UINT) HIWORD (wParam); |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
4758 |
41638
aadcf676d5de
(w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents:
41480
diff
changeset
|
4759 w32_menu_display_help (hwnd, menu, menu_item, flags); |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
4760 } |
28272
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
4761 return 0; |
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
4762 |
21735
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4763 case WM_MEASUREITEM: |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4764 f = x_window_to_frame (dpyinfo, hwnd); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4765 if (f) |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4766 { |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4767 MEASUREITEMSTRUCT * pMis = (MEASUREITEMSTRUCT *) lParam; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4768 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4769 if (pMis->CtlType == ODT_MENU) |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4770 { |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4771 /* Work out dimensions for popup menu titles. */ |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4772 char * title = (char *) pMis->itemData; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4773 HDC hdc = GetDC (hwnd); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4774 HFONT menu_font = GetCurrentObject (hdc, OBJ_FONT); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4775 LOGFONT menu_logfont; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4776 HFONT old_font; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4777 SIZE size; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4778 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4779 GetObject (menu_font, sizeof (menu_logfont), &menu_logfont); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4780 menu_logfont.lfWeight = FW_BOLD; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4781 menu_font = CreateFontIndirect (&menu_logfont); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4782 old_font = SelectObject (hdc, menu_font); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4783 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4784 pMis->itemHeight = GetSystemMetrics (SM_CYMENUSIZE); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4785 if (title) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4786 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4787 GetTextExtentPoint32 (hdc, title, strlen (title), &size); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4788 pMis->itemWidth = size.cx; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4789 if (pMis->itemHeight < size.cy) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4790 pMis->itemHeight = size.cy; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4791 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4792 else |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4793 pMis->itemWidth = 0; |
21735
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4794 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4795 SelectObject (hdc, old_font); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4796 DeleteObject (menu_font); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4797 ReleaseDC (hwnd, hdc); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4798 return TRUE; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4799 } |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4800 } |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4801 return 0; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4802 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4803 case WM_DRAWITEM: |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4804 f = x_window_to_frame (dpyinfo, hwnd); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4805 if (f) |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4806 { |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4807 DRAWITEMSTRUCT * pDis = (DRAWITEMSTRUCT *) lParam; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4808 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4809 if (pDis->CtlType == ODT_MENU) |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4810 { |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4811 /* Draw popup menu title. */ |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4812 char * title = (char *) pDis->itemData; |
30239
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4813 if (title) |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4814 { |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4815 HDC hdc = pDis->hDC; |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4816 HFONT menu_font = GetCurrentObject (hdc, OBJ_FONT); |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4817 LOGFONT menu_logfont; |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4818 HFONT old_font; |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4819 |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4820 GetObject (menu_font, sizeof (menu_logfont), &menu_logfont); |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4821 menu_logfont.lfWeight = FW_BOLD; |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4822 menu_font = CreateFontIndirect (&menu_logfont); |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4823 old_font = SelectObject (hdc, menu_font); |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4824 |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4825 /* Always draw title as if not selected. */ |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4826 ExtTextOut (hdc, |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4827 pDis->rcItem.left |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4828 + GetSystemMetrics (SM_CXMENUCHECK), |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4829 pDis->rcItem.top, |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4830 ETO_OPAQUE, &pDis->rcItem, |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4831 title, strlen (title), NULL); |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4832 |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4833 SelectObject (hdc, old_font); |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4834 DeleteObject (menu_font); |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4835 } |
21735
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4836 return TRUE; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4837 } |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4838 } |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4839 return 0; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4840 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4841 #if 0 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4842 /* Still not right - can't distinguish between clicks in the |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4843 client area of the frame from clicks forwarded from the scroll |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4844 bars - may have to hook WM_NCHITTEST to remember the mouse |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4845 position and then check if it is in the client area ourselves. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4846 case WM_MOUSEACTIVATE: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4847 /* Discard the mouse click that activates a frame, allowing the |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4848 user to click anywhere without changing point (or worse!). |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4849 Don't eat mouse clicks on scrollbars though!! */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4850 if (LOWORD (lParam) == HTCLIENT ) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4851 return MA_ACTIVATEANDEAT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4852 goto dflt; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4853 #endif |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4854 |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4855 case WM_MOUSELEAVE: |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4856 /* No longer tracking mouse. */ |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4857 track_mouse_window = NULL; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4858 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4859 case WM_ACTIVATEAPP: |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4860 case WM_ACTIVATE: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4861 case WM_WINDOWPOSCHANGED: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4862 case WM_SHOWWINDOW: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4863 /* Inform lisp thread that a frame might have just been obscured |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4864 or exposed, so should recheck visibility of all frames. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4865 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4866 goto dflt; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4867 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4868 case WM_SETFOCUS: |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4869 dpyinfo->faked_key = 0; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4870 reset_modifiers (); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4871 register_hot_keys (hwnd); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4872 goto command; |
15314
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
4873 case WM_KILLFOCUS: |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4874 unregister_hot_keys (hwnd); |
24751
e0eaca5025bc
(w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents:
24718
diff
changeset
|
4875 button_state = 0; |
e0eaca5025bc
(w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents:
24718
diff
changeset
|
4876 ReleaseCapture (); |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
4877 /* Relinquish the system caret. */ |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
4878 if (w32_system_caret_hwnd) |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
4879 { |
42918
9b06036a8c5e
(syms_of_w32fns): Initialize w32_visible_system_caret_hwnd.
Jason Rumney <jasonr@gnu.org>
parents:
42865
diff
changeset
|
4880 w32_visible_system_caret_hwnd = NULL; |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
4881 w32_system_caret_hwnd = NULL; |
42918
9b06036a8c5e
(syms_of_w32fns): Initialize w32_visible_system_caret_hwnd.
Jason Rumney <jasonr@gnu.org>
parents:
42865
diff
changeset
|
4882 DestroyCaret (); |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
4883 } |
13434 | 4884 case WM_MOVE: |
4885 case WM_SIZE: | |
4886 case WM_COMMAND: | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4887 command: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4888 wmsg.dwModifiers = w32_get_modifiers (); |
13434 | 4889 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
4890 goto dflt; | |
15034
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
4891 |
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
4892 case WM_CLOSE: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4893 wmsg.dwModifiers = w32_get_modifiers (); |
15034
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
4894 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
|
4895 return 0; |
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
4896 |
13434 | 4897 case WM_WINDOWPOSCHANGING: |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
4898 /* Don't restrict the sizing of tip frames. */ |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
4899 if (hwnd == tip_window) |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
4900 return 0; |
13434 | 4901 { |
4902 WINDOWPLACEMENT wp; | |
4903 LPWINDOWPOS lppos = (WINDOWPOS *) lParam; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4904 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4905 wp.length = sizeof (WINDOWPLACEMENT); |
13434 | 4906 GetWindowPlacement (hwnd, &wp); |
4907 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4908 if (wp.showCmd != SW_SHOWMINIMIZED && (lppos->flags & SWP_NOSIZE) == 0) |
13434 | 4909 { |
4910 RECT rect; | |
4911 int wdiff; | |
4912 int hdiff; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4913 DWORD font_width; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4914 DWORD line_height; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4915 DWORD internal_border; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4916 DWORD scrollbar_extra; |
13434 | 4917 RECT wr; |
4918 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4919 wp.length = sizeof(wp); |
13434 | 4920 GetWindowRect (hwnd, &wr); |
4921 | |
14353 | 4922 enter_crit (); |
13434 | 4923 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4924 font_width = GetWindowLong (hwnd, WND_FONTWIDTH_INDEX); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4925 line_height = GetWindowLong (hwnd, WND_LINEHEIGHT_INDEX); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4926 internal_border = GetWindowLong (hwnd, WND_BORDER_INDEX); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4927 scrollbar_extra = GetWindowLong (hwnd, WND_SCROLLBAR_INDEX); |
13434 | 4928 |
14353 | 4929 leave_crit (); |
13434 | 4930 |
4931 memset (&rect, 0, sizeof (rect)); | |
4932 AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE), | |
4933 GetMenu (hwnd) != NULL); | |
4934 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4935 /* Force width and height of client area to be exact |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4936 multiples of the character cell dimensions. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4937 wdiff = (lppos->cx - (rect.right - rect.left) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4938 - 2 * internal_border - scrollbar_extra) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4939 % font_width; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4940 hdiff = (lppos->cy - (rect.bottom - rect.top) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4941 - 2 * internal_border) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4942 % line_height; |
13434 | 4943 |
4944 if (wdiff || hdiff) | |
4945 { | |
4946 /* For right/bottom sizing we can just fix the sizes. | |
4947 However for top/left sizing we will need to fix the X | |
4948 and Y positions as well. */ | |
4949 | |
4950 lppos->cx -= wdiff; | |
4951 lppos->cy -= hdiff; | |
4952 | |
4953 if (wp.showCmd != SW_SHOWMAXIMIZED | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4954 && (lppos->flags & SWP_NOMOVE) == 0) |
13434 | 4955 { |
4956 if (lppos->x != wr.left || lppos->y != wr.top) | |
4957 { | |
4958 lppos->x += wdiff; | |
4959 lppos->y += hdiff; | |
4960 } | |
4961 else | |
4962 { | |
4963 lppos->flags |= SWP_NOMOVE; | |
4964 } | |
4965 } | |
4966 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4967 return 0; |
13434 | 4968 } |
4969 } | |
4970 } | |
4971 | |
4972 goto dflt; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4973 |
24479
3b2c3636bf0e
(w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24412
diff
changeset
|
4974 case WM_GETMINMAXINFO: |
3b2c3636bf0e
(w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24412
diff
changeset
|
4975 /* Hack to correct bug that allows Emacs frames to be resized |
3b2c3636bf0e
(w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24412
diff
changeset
|
4976 below the Minimum Tracking Size. */ |
3b2c3636bf0e
(w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24412
diff
changeset
|
4977 ((LPMINMAXINFO) lParam)->ptMinTrackSize.y++; |
36080
743534626f73
(w32_wnd_proc) <WM_GETMINMAXINFO>: Allow resizing the
Andrew Innes <andrewi@gnu.org>
parents:
36000
diff
changeset
|
4978 /* Hack to allow resizing the Emacs frame above the screen size. |
743534626f73
(w32_wnd_proc) <WM_GETMINMAXINFO>: Allow resizing the
Andrew Innes <andrewi@gnu.org>
parents:
36000
diff
changeset
|
4979 Note that Windows 9x limits coordinates to 16-bits. */ |
743534626f73
(w32_wnd_proc) <WM_GETMINMAXINFO>: Allow resizing the
Andrew Innes <andrewi@gnu.org>
parents:
36000
diff
changeset
|
4980 ((LPMINMAXINFO) lParam)->ptMaxTrackSize.x = 32767; |
743534626f73
(w32_wnd_proc) <WM_GETMINMAXINFO>: Allow resizing the
Andrew Innes <andrewi@gnu.org>
parents:
36000
diff
changeset
|
4981 ((LPMINMAXINFO) lParam)->ptMaxTrackSize.y = 32767; |
24479
3b2c3636bf0e
(w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24412
diff
changeset
|
4982 return 0; |
3b2c3636bf0e
(w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24412
diff
changeset
|
4983 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4984 case WM_EMACS_CREATESCROLLBAR: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4985 return (LRESULT) w32_createscrollbar ((struct frame *) wParam, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4986 (struct scroll_bar *) lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4987 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4988 case WM_EMACS_SHOWWINDOW: |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4989 return ShowWindow ((HWND) wParam, (WPARAM) lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4990 |
21608
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
4991 case WM_EMACS_SETFOREGROUND: |
24718
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4992 { |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4993 HWND foreground_window; |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4994 DWORD foreground_thread, retval; |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4995 |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4996 /* On NT 5.0, and apparently Windows 98, it is necessary to |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4997 attach to the thread that currently has focus in order to |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4998 pull the focus away from it. */ |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4999 foreground_window = GetForegroundWindow (); |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5000 foreground_thread = GetWindowThreadProcessId (foreground_window, NULL); |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5001 if (!foreground_window |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5002 || foreground_thread == GetCurrentThreadId () |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5003 || !AttachThreadInput (GetCurrentThreadId (), |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5004 foreground_thread, TRUE)) |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5005 foreground_thread = 0; |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5006 |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5007 retval = SetForegroundWindow ((HWND) wParam); |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5008 |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5009 /* Detach from the previous foreground thread. */ |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5010 if (foreground_thread) |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5011 AttachThreadInput (GetCurrentThreadId (), |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5012 foreground_thread, FALSE); |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5013 |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5014 return retval; |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5015 } |
21608
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
5016 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5017 case WM_EMACS_SETWINDOWPOS: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5018 { |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5019 WINDOWPOS * pos = (WINDOWPOS *) wParam; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5020 return SetWindowPos (hwnd, pos->hwndInsertAfter, |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5021 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
|
5022 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5023 |
13434 | 5024 case WM_EMACS_DESTROYWINDOW: |
21884 | 5025 DragAcceptFiles ((HWND) wParam, FALSE); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5026 return DestroyWindow ((HWND) wParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5027 |
42865
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5028 case WM_EMACS_HIDE_CARET: |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5029 return HideCaret (hwnd); |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5030 |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5031 case WM_EMACS_SHOW_CARET: |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5032 return ShowCaret (hwnd); |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5033 |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5034 case WM_EMACS_DESTROY_CARET: |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5035 w32_system_caret_hwnd = NULL; |
42865
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5036 w32_visible_system_caret_hwnd = NULL; |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5037 return DestroyCaret (); |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5038 |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5039 case WM_EMACS_TRACK_CARET: |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5040 /* If there is currently no system caret, create one. */ |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5041 if (w32_system_caret_hwnd == NULL) |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5042 { |
42865
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5043 /* Use the default caret width, and avoid changing it |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5044 unneccesarily, as it confuses screen reader software. */ |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5045 w32_system_caret_hwnd = hwnd; |
42865
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5046 CreateCaret (hwnd, NULL, 0, |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5047 w32_system_caret_height); |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5048 } |
42865
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5049 |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5050 if (!SetCaretPos (w32_system_caret_x, w32_system_caret_y)) |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5051 return 0; |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5052 /* Ensure visible caret gets turned on when requested. */ |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5053 else if (w32_use_visible_system_caret |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5054 && w32_visible_system_caret_hwnd != hwnd) |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5055 { |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5056 w32_visible_system_caret_hwnd = hwnd; |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5057 return ShowCaret (hwnd); |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5058 } |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5059 /* Ensure visible caret gets turned off when requested. */ |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5060 else if (!w32_use_visible_system_caret |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5061 && w32_visible_system_caret_hwnd) |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5062 { |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5063 w32_visible_system_caret_hwnd = NULL; |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5064 return HideCaret (hwnd); |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5065 } |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5066 else |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5067 return 1; |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5068 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5069 case WM_EMACS_TRACKPOPUPMENU: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5070 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5071 UINT flags; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5072 POINT *pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5073 int retval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5074 pos = (POINT *)lParam; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5075 flags = TPM_CENTERALIGN; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5076 if (button_state & LMOUSE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5077 flags |= TPM_LEFTBUTTON; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5078 else if (button_state & RMOUSE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5079 flags |= TPM_RIGHTBUTTON; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5080 |
21735
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
5081 /* Remember we did a SetCapture on the initial mouse down event, |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
5082 so for safety, we make sure the capture is cancelled now. */ |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
5083 ReleaseCapture (); |
23160
95a213639589
(w32_wnd_proc): Always zero button_state when releasing
Geoff Voelker <voelker@cs.washington.edu>
parents:
22625
diff
changeset
|
5084 button_state = 0; |
21735
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
5085 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5086 /* Use menubar_active to indicate that WM_INITMENU is from |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5087 TrackPopupMenu below, and should be ignored. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5088 f = x_window_to_frame (dpyinfo, hwnd); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5089 if (f) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5090 f->output_data.w32->menubar_active = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5091 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5092 if (TrackPopupMenu ((HMENU)wParam, flags, pos->x, pos->y, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5093 0, hwnd, NULL)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5094 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5095 MSG amsg; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5096 /* Eat any mouse messages during popupmenu */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5097 while (PeekMessage (&amsg, hwnd, WM_MOUSEFIRST, WM_MOUSELAST, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5098 PM_REMOVE)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5099 /* Get the menu selection, if any */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5100 if (PeekMessage (&amsg, hwnd, WM_COMMAND, WM_COMMAND, PM_REMOVE)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5101 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5102 retval = LOWORD (amsg.wParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5103 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5104 else |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5105 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5106 retval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5107 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5108 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5109 else |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5110 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5111 retval = -1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5112 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5113 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5114 return retval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5115 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5116 |
13434 | 5117 default: |
21874
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5118 /* Check for messages registered at runtime. */ |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5119 if (msg == msh_mousewheel) |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5120 { |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5121 wmsg.dwModifiers = w32_get_modifiers (); |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5122 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5123 return 0; |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5124 } |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5125 |
13434 | 5126 dflt: |
5127 return DefWindowProc (hwnd, msg, wParam, lParam); | |
5128 } | |
5129 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5130 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5131 /* The most common default return code for handled messages is 0. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5132 return 0; |
13434 | 5133 } |
5134 | |
5135 void | |
5136 my_create_window (f) | |
5137 struct frame * f; | |
5138 { | |
5139 MSG msg; | |
5140 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5141 if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW, (WPARAM)f, 0)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5142 abort (); |
13434 | 5143 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); |
5144 } | |
5145 | |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5146 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5147 /* Create a tooltip window. Unlike my_create_window, we do not do this |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5148 indirectly via the Window thread, as we do not need to process Window |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5149 messages for the tooltip. Creating tooltips indirectly also creates |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5150 deadlocks when tooltips are created for menu items. */ |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5151 void |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5152 my_create_tip_window (f) |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5153 struct frame *f; |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5154 { |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5155 RECT rect; |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5156 |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5157 rect.left = rect.top = 0; |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5158 rect.right = PIXEL_WIDTH (f); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5159 rect.bottom = PIXEL_HEIGHT (f); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5160 |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5161 AdjustWindowRect (&rect, f->output_data.w32->dwStyle, |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5162 FRAME_EXTERNAL_MENU_BAR (f)); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5163 |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5164 tip_window = FRAME_W32_WINDOW (f) |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5165 = CreateWindow (EMACS_CLASS, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5166 f->namebuf, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5167 f->output_data.w32->dwStyle, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5168 f->output_data.w32->left_pos, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5169 f->output_data.w32->top_pos, |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5170 rect.right - rect.left, |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5171 rect.bottom - rect.top, |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5172 FRAME_W32_WINDOW (SELECTED_FRAME ()), /* owner */ |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5173 NULL, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5174 hinst, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5175 NULL); |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5176 |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5177 if (tip_window) |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5178 { |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5179 SetWindowLong (tip_window, WND_FONTWIDTH_INDEX, FONT_WIDTH (f->output_data.w32->font)); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5180 SetWindowLong (tip_window, WND_LINEHEIGHT_INDEX, f->output_data.w32->line_height); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5181 SetWindowLong (tip_window, WND_BORDER_INDEX, f->output_data.w32->internal_border_width); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5182 SetWindowLong (tip_window, WND_BACKGROUND_INDEX, FRAME_BACKGROUND_PIXEL (f)); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5183 |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5184 /* Tip frames have no scrollbars. */ |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5185 SetWindowLong (tip_window, WND_SCROLLBAR_INDEX, 0); |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5186 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5187 /* Do this to discard the default setting specified by our parent. */ |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5188 ShowWindow (tip_window, SW_HIDE); |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5189 } |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5190 } |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5191 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5192 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5193 /* Create and set up the w32 window for frame F. */ |
13434 | 5194 |
5195 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5196 w32_window (f, window_prompting, minibuffer_only) |
13434 | 5197 struct frame *f; |
5198 long window_prompting; | |
5199 int minibuffer_only; | |
5200 { | |
5201 BLOCK_INPUT; | |
5202 | |
5203 /* Use the resource name as the top-level window name | |
5204 for looking up resources. Make a non-Lisp copy | |
5205 for the window manager, so GC relocation won't bother it. | |
5206 | |
5207 Elsewhere we specify the window name for the window manager. */ | |
5208 | |
5209 { | |
5210 char *str = (char *) XSTRING (Vx_resource_name)->data; | |
5211 f->namebuf = (char *) xmalloc (strlen (str) + 1); | |
5212 strcpy (f->namebuf, str); | |
5213 } | |
5214 | |
5215 my_create_window (f); | |
5216 | |
5217 validate_x_resource_name (); | |
5218 | |
5219 /* x_set_name normally ignores requests to set the name if the | |
5220 requested name is the same as the current name. This is the one | |
5221 place where that assumption isn't correct; f->name is set, but | |
5222 the server hasn't been told. */ | |
5223 { | |
5224 Lisp_Object name; | |
5225 int explicit = f->explicit_name; | |
5226 | |
5227 f->explicit_name = 0; | |
5228 name = f->name; | |
5229 f->name = Qnil; | |
5230 x_set_name (f, name, explicit); | |
5231 } | |
5232 | |
5233 UNBLOCK_INPUT; | |
5234 | |
5235 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f)) | |
5236 initialize_frame_menubar (f); | |
5237 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5238 if (FRAME_W32_WINDOW (f) == 0) |
13434 | 5239 error ("Unable to create window"); |
5240 } | |
5241 | |
5242 /* Handle the icon stuff for this window. Perhaps later we might | |
5243 want an x_set_icon_position which can be called interactively as | |
5244 well. */ | |
5245 | |
5246 static void | |
5247 x_icon (f, parms) | |
5248 struct frame *f; | |
5249 Lisp_Object parms; | |
5250 { | |
5251 Lisp_Object icon_x, icon_y; | |
5252 | |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
5253 /* Set the position of the icon. Note that Windows 95 groups all |
13434 | 5254 icons in the tray. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5255 icon_x = w32_get_arg (parms, Qicon_left, 0, 0, RES_TYPE_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5256 icon_y = w32_get_arg (parms, Qicon_top, 0, 0, RES_TYPE_NUMBER); |
13434 | 5257 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) |
5258 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
5259 CHECK_NUMBER (icon_x); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
5260 CHECK_NUMBER (icon_y); |
13434 | 5261 } |
5262 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) | |
5263 error ("Both left and top icon corners of icon must be specified"); | |
5264 | |
5265 BLOCK_INPUT; | |
5266 | |
5267 if (! EQ (icon_x, Qunbound)) | |
5268 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); | |
5269 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5270 #if 0 /* TODO */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5271 /* Start up iconic or window? */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5272 x_wm_set_window_state |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5273 (f, (EQ (w32_get_arg (parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL), Qicon) |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5274 ? IconicState |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5275 : NormalState)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5276 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5277 x_text_icon (f, (char *) XSTRING ((!NILP (f->icon_name) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5278 ? f->icon_name |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5279 : f->name))->data); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5280 #endif |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5281 |
13434 | 5282 UNBLOCK_INPUT; |
5283 } | |
5284 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5285 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5286 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5287 x_make_gc (f) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5288 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5289 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5290 XGCValues gc_values; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5291 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5292 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5293 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5294 /* Create the GC's of this frame. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5295 Note that many default values are used. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5296 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5297 /* Normal video */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5298 gc_values.font = f->output_data.w32->font; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5299 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5300 /* Cursor has cursor-color background, background-color foreground. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5301 gc_values.foreground = FRAME_BACKGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5302 gc_values.background = f->output_data.w32->cursor_pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5303 f->output_data.w32->cursor_gc |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5304 = XCreateGC (NULL, FRAME_W32_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5305 (GCFont | GCForeground | GCBackground), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5306 &gc_values); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5307 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5308 /* Reliefs. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5309 f->output_data.w32->white_relief.gc = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5310 f->output_data.w32->black_relief.gc = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5311 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5312 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5313 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5314 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5315 |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5316 /* Handler for signals raised during x_create_frame and |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5317 x_create_top_frame. FRAME is the frame which is partially |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5318 constructed. */ |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5319 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5320 static Lisp_Object |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5321 unwind_create_frame (frame) |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5322 Lisp_Object frame; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5323 { |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5324 struct frame *f = XFRAME (frame); |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5325 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5326 /* If frame is ``official'', nothing to do. */ |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5327 if (!CONSP (Vframe_list) || !EQ (XCAR (Vframe_list), frame)) |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5328 { |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5329 #ifdef GLYPH_DEBUG |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5330 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5331 #endif |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5332 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5333 x_free_frame_resources (f); |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5334 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5335 /* Check that reference counts are indeed correct. */ |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5336 xassert (dpyinfo->reference_count == dpyinfo_refcount); |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5337 xassert (dpyinfo->image_cache->refcount == image_cache_refcount); |
34638
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
5338 |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
5339 return Qt; |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5340 } |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5341 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5342 return Qnil; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5343 } |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5344 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5345 |
13434 | 5346 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, |
5347 1, 1, 0, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
5348 doc: /* Make a new window, which is called a \"frame\" in Emacs terms. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
5349 Returns an Emacs frame object. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
5350 ALIST is an alist of frame parameters. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
5351 If the parameters specify that the frame should not have a minibuffer, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
5352 and do not specify a specific minibuffer window to use, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
5353 then `default-minibuffer-frame' must be a frame whose minibuffer can |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
5354 be shared by the new frame. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
5355 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
5356 This function is an internal primitive--use `make-frame' instead. */) |
13434 | 5357 (parms) |
5358 Lisp_Object parms; | |
5359 { | |
5360 struct frame *f; | |
5361 Lisp_Object frame, tem; | |
5362 Lisp_Object name; | |
5363 int minibuffer_only = 0; | |
5364 long window_prompting = 0; | |
5365 int width, height; | |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
5366 int count = BINDING_STACK_SIZE (); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5367 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
13434 | 5368 Lisp_Object display; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5369 struct w32_display_info *dpyinfo = NULL; |
13434 | 5370 Lisp_Object parent; |
5371 struct kboard *kb; | |
5372 | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5373 check_w32 (); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5374 |
13434 | 5375 /* Use this general default value to start with |
5376 until we know if this frame has a specified name. */ | |
5377 Vx_resource_name = Vinvocation_name; | |
5378 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5379 display = w32_get_arg (parms, Qdisplay, 0, 0, RES_TYPE_STRING); |
13434 | 5380 if (EQ (display, Qunbound)) |
5381 display = Qnil; | |
5382 dpyinfo = check_x_display_info (display); | |
5383 #ifdef MULTI_KBOARD | |
5384 kb = dpyinfo->kboard; | |
5385 #else | |
5386 kb = &the_only_kboard; | |
5387 #endif | |
5388 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5389 name = w32_get_arg (parms, Qname, "name", "Name", RES_TYPE_STRING); |
13434 | 5390 if (!STRINGP (name) |
5391 && ! EQ (name, Qunbound) | |
5392 && ! NILP (name)) | |
5393 error ("Invalid frame name--not a string or nil"); | |
5394 | |
5395 if (STRINGP (name)) | |
5396 Vx_resource_name = name; | |
5397 | |
5398 /* See if parent window is specified. */ | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5399 parent = w32_get_arg (parms, Qparent_id, NULL, NULL, RES_TYPE_NUMBER); |
13434 | 5400 if (EQ (parent, Qunbound)) |
5401 parent = Qnil; | |
5402 if (! NILP (parent)) | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
5403 CHECK_NUMBER (parent); |
13434 | 5404 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5405 /* make_frame_without_minibuffer can run Lisp code and garbage collect. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5406 /* No need to protect DISPLAY because that's not used after passing |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5407 it to make_frame_without_minibuffer. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5408 frame = Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5409 GCPRO4 (parms, parent, name, frame); |
32669
092d2df2a6c3
(Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents:
31110
diff
changeset
|
5410 tem = w32_get_arg (parms, Qminibuffer, "minibuffer", "Minibuffer", |
092d2df2a6c3
(Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents:
31110
diff
changeset
|
5411 RES_TYPE_SYMBOL); |
13434 | 5412 if (EQ (tem, Qnone) || NILP (tem)) |
5413 f = make_frame_without_minibuffer (Qnil, kb, display); | |
5414 else if (EQ (tem, Qonly)) | |
5415 { | |
5416 f = make_minibuffer_frame (); | |
5417 minibuffer_only = 1; | |
5418 } | |
5419 else if (WINDOWP (tem)) | |
5420 f = make_frame_without_minibuffer (tem, kb, display); | |
5421 else | |
5422 f = make_frame (1); | |
5423 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5424 XSETFRAME (frame, f); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5425 |
13434 | 5426 /* Note that Windows does support scroll bars. */ |
5427 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
|
5428 /* 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
|
5429 f->scroll_bar_pixel_width = GetSystemMetrics (SM_CXVSCROLL); |
13434 | 5430 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5431 f->output_method = output_w32; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5432 f->output_data.w32 = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5433 (struct w32_output *) xmalloc (sizeof (struct w32_output)); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5434 bzero (f->output_data.w32, sizeof (struct w32_output)); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5435 FRAME_FONTSET (f) = -1; |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5436 record_unwind_protect (unwind_create_frame, frame); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5437 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5438 f->icon_name |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5439 = w32_get_arg (parms, Qicon_name, "iconName", "Title", RES_TYPE_STRING); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5440 if (! STRINGP (f->icon_name)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5441 f->icon_name = Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5442 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5443 /* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */ |
13434 | 5444 #ifdef MULTI_KBOARD |
5445 FRAME_KBOARD (f) = kb; | |
5446 #endif | |
5447 | |
5448 /* Specify the parent under which to make this window. */ | |
5449 | |
5450 if (!NILP (parent)) | |
5451 { | |
32669
092d2df2a6c3
(Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents:
31110
diff
changeset
|
5452 f->output_data.w32->parent_desc = (Window) XFASTINT (parent); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5453 f->output_data.w32->explicit_parent = 1; |
13434 | 5454 } |
5455 else | |
5456 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5457 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5458 f->output_data.w32->explicit_parent = 0; |
13434 | 5459 } |
5460 | |
5461 /* Set the name; the functions to which we pass f expect the name to | |
5462 be set. */ | |
5463 if (EQ (name, Qunbound) || NILP (name)) | |
5464 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5465 f->name = build_string (dpyinfo->w32_id_name); |
13434 | 5466 f->explicit_name = 0; |
5467 } | |
5468 else | |
5469 { | |
5470 f->name = name; | |
5471 f->explicit_name = 1; | |
5472 /* use the frame's title when getting resources for this frame. */ | |
5473 specbind (Qx_resource_name, name); | |
5474 } | |
5475 | |
5476 /* Extract the window parameters from the supplied values | |
5477 that are needed to determine window geometry. */ | |
5478 { | |
5479 Lisp_Object font; | |
5480 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5481 font = w32_get_arg (parms, Qfont, "font", "Font", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5482 |
13434 | 5483 BLOCK_INPUT; |
5484 /* First, try whatever font the caller has specified. */ | |
5485 if (STRINGP (font)) | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5486 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5487 tem = Fquery_fontset (font, Qnil); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5488 if (STRINGP (tem)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5489 font = x_new_fontset (f, XSTRING (tem)->data); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5490 else |
24481
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
5491 font = x_new_font (f, XSTRING (font)->data); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5492 } |
13434 | 5493 /* Try out a font which we hope has bold and italic variations. */ |
5494 if (!STRINGP (font)) | |
32977
d0421102ed8c
(Fx_create_frame): Make default fontsize on w32 10 point, as Windows
Jason Rumney <jasonr@gnu.org>
parents:
32791
diff
changeset
|
5495 font = x_new_font (f, "-*-Courier New-normal-r-*-*-*-100-*-*-c-*-iso8859-1"); |
13434 | 5496 if (! STRINGP (font)) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5497 font = x_new_font (f, "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1"); |
13434 | 5498 /* If those didn't work, look for something which will at least work. */ |
5499 if (! STRINGP (font)) | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5500 font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1"); |
13434 | 5501 UNBLOCK_INPUT; |
5502 if (! STRINGP (font)) | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5503 font = build_string ("Fixedsys"); |
13434 | 5504 |
5505 x_default_parameter (f, parms, Qfont, font, | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5506 "font", "Font", RES_TYPE_STRING); |
13434 | 5507 } |
5508 | |
5509 x_default_parameter (f, parms, Qborder_width, make_number (2), | |
32669
092d2df2a6c3
(Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents:
31110
diff
changeset
|
5510 "borderWidth", "BorderWidth", RES_TYPE_NUMBER); |
13434 | 5511 /* This defaults to 2 in order to match xterm. We recognize either |
5512 internalBorderWidth or internalBorder (which is what xterm calls | |
5513 it). */ | |
5514 if (NILP (Fassq (Qinternal_border_width, parms))) | |
5515 { | |
5516 Lisp_Object value; | |
5517 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5518 value = w32_get_arg (parms, Qinternal_border_width, |
32669
092d2df2a6c3
(Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents:
31110
diff
changeset
|
5519 "internalBorder", "InternalBorder", RES_TYPE_NUMBER); |
13434 | 5520 if (! EQ (value, Qunbound)) |
5521 parms = Fcons (Fcons (Qinternal_border_width, value), | |
5522 parms); | |
5523 } | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5524 /* Default internalBorderWidth to 0 on Windows to match other programs. */ |
13434 | 5525 x_default_parameter (f, parms, Qinternal_border_width, make_number (0), |
32669
092d2df2a6c3
(Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents:
31110
diff
changeset
|
5526 "internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER); |
092d2df2a6c3
(Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents:
31110
diff
changeset
|
5527 x_default_parameter (f, parms, Qvertical_scroll_bars, Qright, |
092d2df2a6c3
(Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents:
31110
diff
changeset
|
5528 "verticalScrollBars", "ScrollBars", RES_TYPE_SYMBOL); |
13434 | 5529 |
5530 /* Also do the stuff which must be set before the window exists. */ | |
5531 x_default_parameter (f, parms, Qforeground_color, build_string ("black"), | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5532 "foreground", "Foreground", RES_TYPE_STRING); |
13434 | 5533 x_default_parameter (f, parms, Qbackground_color, build_string ("white"), |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5534 "background", "Background", RES_TYPE_STRING); |
13434 | 5535 x_default_parameter (f, parms, Qmouse_color, build_string ("black"), |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5536 "pointerColor", "Foreground", RES_TYPE_STRING); |
13434 | 5537 x_default_parameter (f, parms, Qcursor_color, build_string ("black"), |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5538 "cursorColor", "Foreground", RES_TYPE_STRING); |
13434 | 5539 x_default_parameter (f, parms, Qborder_color, build_string ("black"), |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5540 "borderColor", "BorderColor", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5541 x_default_parameter (f, parms, Qscreen_gamma, Qnil, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5542 "screenGamma", "ScreenGamma", RES_TYPE_FLOAT); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
5543 x_default_parameter (f, parms, Qline_spacing, Qnil, |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
5544 "lineSpacing", "LineSpacing", RES_TYPE_NUMBER); |
41726
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
5545 x_default_parameter (f, parms, Qleft_fringe, Qnil, |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
5546 "leftFringe", "LeftFringe", RES_TYPE_NUMBER); |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
5547 x_default_parameter (f, parms, Qright_fringe, Qnil, |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
5548 "rightFringe", "RightFringe", RES_TYPE_NUMBER); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5549 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5550 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5551 /* Init faces before x_default_parameter is called for scroll-bar |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5552 parameters because that function calls x_set_scroll_bar_width, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5553 which calls change_frame_size, which calls Fset_window_buffer, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5554 which runs hooks, which call Fvertical_motion. At the end, we |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5555 end up in init_iterator with a null face cache, which should not |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5556 happen. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5557 init_frame_faces (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5558 |
13434 | 5559 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5560 "menuBar", "MenuBar", RES_TYPE_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5561 x_default_parameter (f, parms, Qtool_bar_lines, make_number (0), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5562 "toolBar", "ToolBar", RES_TYPE_NUMBER); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5563 x_default_parameter (f, parms, Qbuffer_predicate, Qnil, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5564 "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5565 x_default_parameter (f, parms, Qtitle, Qnil, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5566 "title", "Title", RES_TYPE_STRING); |
13434 | 5567 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5568 f->output_data.w32->dwStyle = WS_OVERLAPPEDWINDOW; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5569 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5570 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5571 /* Add the tool-bar height to the initial frame height so that the |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5572 user gets a text display area of the size he specified with -g or |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5573 via .Xdefaults. Later changes of the tool-bar height don't |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5574 change the frame size. This is done so that users can create |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5575 tall Emacs frames without having to guess how tall the tool-bar |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5576 will get. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5577 if (FRAME_TOOL_BAR_LINES (f)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5578 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5579 int margin, relief, bar_height; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5580 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
5581 relief = (tool_bar_button_relief >= 0 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5582 ? tool_bar_button_relief |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5583 : DEFAULT_TOOL_BAR_BUTTON_RELIEF); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5584 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5585 if (INTEGERP (Vtool_bar_button_margin) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5586 && XINT (Vtool_bar_button_margin) > 0) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5587 margin = XFASTINT (Vtool_bar_button_margin); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5588 else if (CONSP (Vtool_bar_button_margin) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5589 && INTEGERP (XCDR (Vtool_bar_button_margin)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5590 && XINT (XCDR (Vtool_bar_button_margin)) > 0) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5591 margin = XFASTINT (XCDR (Vtool_bar_button_margin)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5592 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5593 margin = 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5594 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5595 bar_height = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5596 f->height += (bar_height + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5597 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5598 |
13434 | 5599 window_prompting = x_figure_window_size (f, parms); |
5600 | |
5601 if (window_prompting & XNegative) | |
5602 { | |
5603 if (window_prompting & YNegative) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5604 f->output_data.w32->win_gravity = SouthEastGravity; |
13434 | 5605 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5606 f->output_data.w32->win_gravity = NorthEastGravity; |
13434 | 5607 } |
5608 else | |
5609 { | |
5610 if (window_prompting & YNegative) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5611 f->output_data.w32->win_gravity = SouthWestGravity; |
13434 | 5612 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5613 f->output_data.w32->win_gravity = NorthWestGravity; |
13434 | 5614 } |
5615 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5616 f->output_data.w32->size_hint_flags = window_prompting; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5617 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5618 tem = w32_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5619 f->no_split = minibuffer_only || EQ (tem, Qt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5620 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5621 w32_window (f, window_prompting, minibuffer_only); |
13434 | 5622 x_icon (f, parms); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5623 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5624 x_make_gc (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5625 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5626 /* Now consider the frame official. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5627 FRAME_W32_DISPLAY_INFO (f)->reference_count++; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5628 Vframe_list = Fcons (frame, Vframe_list); |
13434 | 5629 |
5630 /* We need to do this after creating the window, so that the | |
5631 icon-creation functions can say whose icon they're describing. */ | |
5632 x_default_parameter (f, parms, Qicon_type, Qnil, | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5633 "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL); |
13434 | 5634 |
5635 x_default_parameter (f, parms, Qauto_raise, Qnil, | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5636 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); |
13434 | 5637 x_default_parameter (f, parms, Qauto_lower, Qnil, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5638 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN); |
13434 | 5639 x_default_parameter (f, parms, Qcursor_type, Qbox, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5640 "cursorType", "CursorType", RES_TYPE_SYMBOL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5641 x_default_parameter (f, parms, Qscroll_bar_width, Qnil, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5642 "scrollBarWidth", "ScrollBarWidth", RES_TYPE_NUMBER); |
13434 | 5643 |
5644 /* Dimensions, especially f->height, must be done via change_frame_size. | |
5645 Change will not be effected unless different from the current | |
5646 f->height. */ | |
5647 width = f->width; | |
5648 height = f->height; | |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
5649 |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
5650 f->height = 0; |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
5651 SET_FRAME_WIDTH (f, 0); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5652 change_frame_size (f, height, width, 1, 0, 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5653 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5654 /* Tell the server what size and position, etc, we want, and how |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5655 badly we want them. This should be done after we have the menu |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5656 bar so that its size can be taken into account. */ |
13434 | 5657 BLOCK_INPUT; |
5658 x_wm_set_size_hint (f, window_prompting, 0); | |
5659 UNBLOCK_INPUT; | |
5660 | |
42833
4510d4d4bac4
(Fx_create_frame): Bind redisplay-dont-pause around
Jason Rumney <jasonr@gnu.org>
parents:
42719
diff
changeset
|
5661 /* Avoid a bug that causes the new frame to never become visible if |
4510d4d4bac4
(Fx_create_frame): Bind redisplay-dont-pause around
Jason Rumney <jasonr@gnu.org>
parents:
42719
diff
changeset
|
5662 an echo area message is displayed during the following call1. */ |
4510d4d4bac4
(Fx_create_frame): Bind redisplay-dont-pause around
Jason Rumney <jasonr@gnu.org>
parents:
42719
diff
changeset
|
5663 specbind(Qredisplay_dont_pause, Qt); |
4510d4d4bac4
(Fx_create_frame): Bind redisplay-dont-pause around
Jason Rumney <jasonr@gnu.org>
parents:
42719
diff
changeset
|
5664 |
34133
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
5665 /* Set up faces after all frame parameters are known. This call |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
5666 also merges in face attributes specified for new frames. If we |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
5667 don't do this, the `menu' face for instance won't have the right |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
5668 colors, and the menu bar won't appear in the specified colors for |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
5669 new frames. */ |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
5670 call1 (Qface_set_after_frame_default, frame); |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
5671 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5672 /* Make the window appear on the frame and enable display, unless |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5673 the caller says not to. However, with explicit parent, Emacs |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5674 cannot control visibility, so don't try. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5675 if (! f->output_data.w32->explicit_parent) |
13434 | 5676 { |
5677 Lisp_Object visibility; | |
5678 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5679 visibility = w32_get_arg (parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL); |
13434 | 5680 if (EQ (visibility, Qunbound)) |
5681 visibility = Qt; | |
5682 | |
5683 if (EQ (visibility, Qicon)) | |
5684 x_iconify_frame (f); | |
5685 else if (! NILP (visibility)) | |
5686 x_make_frame_visible (f); | |
5687 else | |
5688 /* Must have been Qnil. */ | |
5689 ; | |
5690 } | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5691 UNGCPRO; |
36594
756c28377036
(Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
36312
diff
changeset
|
5692 |
756c28377036
(Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
36312
diff
changeset
|
5693 /* Make sure windows on this frame appear in calls to next-window |
756c28377036
(Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
36312
diff
changeset
|
5694 and similar functions. */ |
756c28377036
(Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
36312
diff
changeset
|
5695 Vwindow_list = Qnil; |
756c28377036
(Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
36312
diff
changeset
|
5696 |
13434 | 5697 return unbind_to (count, frame); |
5698 } | |
5699 | |
5700 /* FRAME is used only to get a handle on the X display. We don't pass the | |
5701 display info directly because we're called from frame.c, which doesn't | |
5702 know about that structure. */ | |
5703 Lisp_Object | |
5704 x_get_focus_frame (frame) | |
5705 struct frame *frame; | |
5706 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5707 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (frame); |
13434 | 5708 Lisp_Object xfocus; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5709 if (! dpyinfo->w32_focus_frame) |
13434 | 5710 return Qnil; |
5711 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5712 XSETFRAME (xfocus, dpyinfo->w32_focus_frame); |
13434 | 5713 return xfocus; |
5714 } | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5715 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5716 DEFUN ("w32-focus-frame", Fw32_focus_frame, Sw32_focus_frame, 1, 1, 0, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
5717 doc: /* Give FRAME input focus, raising to foreground if necessary. */) |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5718 (frame) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5719 Lisp_Object frame; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5720 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5721 x_focus_on_frame (check_x_frame (frame)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5722 return Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5723 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5724 |
13434 | 5725 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5726 /* Return the charset portion of a font name. */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5727 char * xlfd_charset_of_font (char * fontname) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5728 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5729 char *charset, *encoding; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5730 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5731 encoding = strrchr(fontname, '-'); |
34284
3a21ff35392b
(xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents:
34133
diff
changeset
|
5732 if (!encoding || encoding == fontname) |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5733 return NULL; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5734 |
34314
8318a4ea6764
(xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents:
34284
diff
changeset
|
5735 for (charset = encoding - 1; charset >= fontname; charset--) |
8318a4ea6764
(xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents:
34284
diff
changeset
|
5736 if (*charset == '-') |
8318a4ea6764
(xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents:
34284
diff
changeset
|
5737 break; |
8318a4ea6764
(xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents:
34284
diff
changeset
|
5738 |
8318a4ea6764
(xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents:
34284
diff
changeset
|
5739 if (charset == fontname || strcmp(charset, "-*-*") == 0) |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5740 return NULL; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5741 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5742 return charset + 1; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5743 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5744 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5745 struct font_info *w32_load_bdf_font (struct frame *f, char *fontname, |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5746 int size, char* filename); |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
5747 static Lisp_Object w32_list_bdf_fonts (Lisp_Object pattern, int max_names); |
37707
6bc1c4d4eb50
(w32_to_x_font): Change prototype to fit the declaration.
Eli Zaretskii <eliz@gnu.org>
parents:
36594
diff
changeset
|
5748 static BOOL w32_to_x_font (LOGFONT * lplf, char * lpxstr, int len, |
6bc1c4d4eb50
(w32_to_x_font): Change prototype to fit the declaration.
Eli Zaretskii <eliz@gnu.org>
parents:
36594
diff
changeset
|
5749 char * charset); |
6bc1c4d4eb50
(w32_to_x_font): Change prototype to fit the declaration.
Eli Zaretskii <eliz@gnu.org>
parents:
36594
diff
changeset
|
5750 static BOOL x_to_w32_font (char *lpxstr, LOGFONT *lplogfont); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5751 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
5752 static struct font_info * |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5753 w32_load_system_font (f,fontname,size) |
24670 | 5754 struct frame *f; |
5755 char * fontname; | |
5756 int size; | |
13434 | 5757 { |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5758 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5759 Lisp_Object font_names; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5760 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5761 /* Get a list of all the fonts that match this name. Once we |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5762 have a list of matching fonts, we compare them against the fonts |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5763 we already have loaded by comparing names. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5764 font_names = w32_list_fonts (f, build_string (fontname), size, 100); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5765 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5766 if (!NILP (font_names)) |
14353 | 5767 { |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5768 Lisp_Object tail; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5769 int i; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5770 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5771 /* First check if any are already loaded, as that is cheaper |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5772 than loading another one. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5773 for (i = 0; i < dpyinfo->n_fonts; i++) |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
5774 for (tail = font_names; CONSP (tail); tail = XCDR (tail)) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5775 if (dpyinfo->font_table[i].name |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5776 && (!strcmp (dpyinfo->font_table[i].name, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5777 XSTRING (XCAR (tail))->data) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5778 || !strcmp (dpyinfo->font_table[i].full_name, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5779 XSTRING (XCAR (tail))->data))) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5780 return (dpyinfo->font_table + i); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5781 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
5782 fontname = (char *) XSTRING (XCAR (font_names))->data; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5783 } |
24481
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
5784 else if (w32_strict_fontnames) |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5785 { |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5786 /* If EnumFontFamiliesEx was available, we got a full list of |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5787 fonts back so stop now to avoid the possibility of loading a |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5788 random font. If we had to fall back to EnumFontFamilies, the |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5789 list is incomplete, so continue whether the font we want was |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5790 listed or not. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5791 HMODULE gdi32 = GetModuleHandle ("gdi32.dll"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5792 FARPROC enum_font_families_ex |
24481
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
5793 = GetProcAddress (gdi32, "EnumFontFamiliesExA"); |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5794 if (enum_font_families_ex) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5795 return NULL; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5796 } |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5797 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5798 /* Load the font and add it to the table. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5799 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5800 char *full_name, *encoding, *charset; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5801 XFontStruct *font; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5802 struct font_info *fontp; |
14353 | 5803 LOGFONT lf; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5804 BOOL ok; |
40009
f6ecf530f0a3
(w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
5805 int codepage; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5806 int i; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5807 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5808 if (!fontname || !x_to_w32_font (fontname, &lf)) |
14353 | 5809 return (NULL); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5810 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5811 if (!*lf.lfFaceName) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5812 /* If no name was specified for the font, we get a random font |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5813 from CreateFontIndirect - this is not particularly |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5814 desirable, especially since CreateFontIndirect does not |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5815 fill out the missing name in lf, so we never know what we |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5816 ended up with. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5817 return NULL; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5818 |
14353 | 5819 font = (XFontStruct *) xmalloc (sizeof (XFontStruct)); |
32721
0574ffc14f77
(w32_load_system_font): Call w32_cache_char_metrics.
Andrew Innes <andrewi@gnu.org>
parents:
32669
diff
changeset
|
5820 bzero (font, sizeof (*font)); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5821 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5822 /* Set bdf to NULL to indicate that this is a Windows font. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5823 font->bdf = NULL; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5824 |
14353 | 5825 BLOCK_INPUT; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5826 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5827 font->hfont = CreateFontIndirect (&lf); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5828 |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5829 if (font->hfont == NULL) |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5830 { |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5831 ok = FALSE; |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5832 } |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5833 else |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5834 { |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5835 HDC hdc; |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5836 HANDLE oldobj; |
40009
f6ecf530f0a3
(w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
5837 |
f6ecf530f0a3
(w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
5838 codepage = w32_codepage_for_font (fontname); |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5839 |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5840 hdc = GetDC (dpyinfo->root_window); |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5841 oldobj = SelectObject (hdc, font->hfont); |
33929
886f1ee076bd
(w32_load_system_font): Always mark font as double byte if codepage is unicode.
Jason Rumney <jasonr@gnu.org>
parents:
33879
diff
changeset
|
5842 |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5843 ok = GetTextMetrics (hdc, &font->tm); |
33929
886f1ee076bd
(w32_load_system_font): Always mark font as double byte if codepage is unicode.
Jason Rumney <jasonr@gnu.org>
parents:
33879
diff
changeset
|
5844 if (codepage == CP_UNICODE) |
886f1ee076bd
(w32_load_system_font): Always mark font as double byte if codepage is unicode.
Jason Rumney <jasonr@gnu.org>
parents:
33879
diff
changeset
|
5845 font->double_byte_p = 1; |
886f1ee076bd
(w32_load_system_font): Always mark font as double byte if codepage is unicode.
Jason Rumney <jasonr@gnu.org>
parents:
33879
diff
changeset
|
5846 else |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5847 { |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5848 /* Unfortunately, some fonts (eg. MingLiU, a big5 ttf font) |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5849 don't report themselves as double byte fonts, when |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5850 patently they are. So instead of trusting |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5851 GetFontLanguageInfo, we check the properties of the |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5852 codepage directly, since that is ultimately what we are |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5853 working from anyway. */ |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5854 /* font->double_byte_p = GetFontLanguageInfo(hdc) & GCP_DBCS; */ |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5855 CPINFO cpi = {0}; |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5856 GetCPInfo (codepage, &cpi); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5857 font->double_byte_p = cpi.MaxCharSize > 1; |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5858 } |
33929
886f1ee076bd
(w32_load_system_font): Always mark font as double byte if codepage is unicode.
Jason Rumney <jasonr@gnu.org>
parents:
33879
diff
changeset
|
5859 |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5860 SelectObject (hdc, oldobj); |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5861 ReleaseDC (dpyinfo->root_window, hdc); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5862 /* Fill out details in lf according to the font that was |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5863 actually loaded. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5864 lf.lfHeight = font->tm.tmInternalLeading - font->tm.tmHeight; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5865 lf.lfWidth = font->tm.tmAveCharWidth; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5866 lf.lfWeight = font->tm.tmWeight; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5867 lf.lfItalic = font->tm.tmItalic; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5868 lf.lfCharSet = font->tm.tmCharSet; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5869 lf.lfPitchAndFamily = ((font->tm.tmPitchAndFamily & TMPF_FIXED_PITCH) |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
5870 ? VARIABLE_PITCH : FIXED_PITCH); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5871 lf.lfOutPrecision = ((font->tm.tmPitchAndFamily & TMPF_VECTOR) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5872 ? OUT_STROKE_PRECIS : OUT_STRING_PRECIS); |
32721
0574ffc14f77
(w32_load_system_font): Call w32_cache_char_metrics.
Andrew Innes <andrewi@gnu.org>
parents:
32669
diff
changeset
|
5873 |
0574ffc14f77
(w32_load_system_font): Call w32_cache_char_metrics.
Andrew Innes <andrewi@gnu.org>
parents:
32669
diff
changeset
|
5874 w32_cache_char_metrics (font); |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5875 } |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5876 |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5877 UNBLOCK_INPUT; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5878 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5879 if (!ok) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5880 { |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5881 w32_unload_font (dpyinfo, font); |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5882 return (NULL); |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5883 } |
13434 | 5884 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5885 /* Find a free slot in the font table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5886 for (i = 0; i < dpyinfo->n_fonts; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5887 if (dpyinfo->font_table[i].name == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5888 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5889 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5890 /* If no free slot found, maybe enlarge the font table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5891 if (i == dpyinfo->n_fonts |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5892 && dpyinfo->n_fonts == dpyinfo->font_table_size) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5893 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5894 int sz; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5895 dpyinfo->font_table_size = max (16, 2 * dpyinfo->font_table_size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5896 sz = dpyinfo->font_table_size * sizeof *dpyinfo->font_table; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5897 dpyinfo->font_table |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5898 = (struct font_info *) xrealloc (dpyinfo->font_table, sz); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5899 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5900 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5901 fontp = dpyinfo->font_table + i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5902 if (i == dpyinfo->n_fonts) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5903 ++dpyinfo->n_fonts; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5904 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5905 /* Now fill in the slots of *FONTP. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5906 BLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5907 fontp->font = font; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5908 fontp->font_idx = i; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5909 fontp->name = (char *) xmalloc (strlen (fontname) + 1); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5910 bcopy (fontname, fontp->name, strlen (fontname) + 1); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5911 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5912 charset = xlfd_charset_of_font (fontname); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5913 |
40009
f6ecf530f0a3
(w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
5914 /* Cache the W32 codepage for a font. This makes w32_encode_char |
f6ecf530f0a3
(w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
5915 (called for every glyph during redisplay) much faster. */ |
f6ecf530f0a3
(w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
5916 fontp->codepage = codepage; |
f6ecf530f0a3
(w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
5917 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5918 /* Work out the font's full name. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5919 full_name = (char *)xmalloc (100); |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5920 if (full_name && w32_to_x_font (&lf, full_name, 100, charset)) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5921 fontp->full_name = full_name; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5922 else |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5923 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5924 /* If all else fails - just use the name we used to load it. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5925 xfree (full_name); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5926 fontp->full_name = fontp->name; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5927 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5928 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5929 fontp->size = FONT_WIDTH (font); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5930 fontp->height = FONT_HEIGHT (font); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5931 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5932 /* The slot `encoding' specifies how to map a character |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5933 code-points (0x20..0x7F or 0x2020..0x7F7F) of each charset to |
28272
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
5934 the font code-points (0:0x20..0x7F, 1:0xA0..0xFF), or |
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
5935 (0:0x20..0x7F, 1:0xA0..0xFF, |
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
5936 (0:0x2020..0x7F7F, 1:0xA0A0..0xFFFF, 3:0x20A0..0x7FFF, |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5937 2:0xA020..0xFF7F). For the moment, we don't know which charset |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5938 uses this font. So, we set information in fontp->encoding[1] |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5939 which is never used by any charset. If mapping can't be |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5940 decided, set FONT_ENCODING_NOT_DECIDED. */ |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5941 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5942 /* SJIS fonts need to be set to type 4, all others seem to work as |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5943 type FONT_ENCODING_NOT_DECIDED. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5944 encoding = strrchr (fontp->name, '-'); |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
5945 if (encoding && strnicmp (encoding+1, "sjis", 4) == 0) |
24692
a0a2521b783d
(x_to_w32_charset): Fix typo: want to map all Japanese
Andrew Innes <andrewi@gnu.org>
parents:
24679
diff
changeset
|
5946 fontp->encoding[1] = 4; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5947 else |
24692
a0a2521b783d
(x_to_w32_charset): Fix typo: want to map all Japanese
Andrew Innes <andrewi@gnu.org>
parents:
24679
diff
changeset
|
5948 fontp->encoding[1] = FONT_ENCODING_NOT_DECIDED; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5949 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5950 /* The following three values are set to 0 under W32, which is |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5951 what they get set to if XGetFontProperty fails under X. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5952 fontp->baseline_offset = 0; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5953 fontp->relative_compose = 0; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5954 fontp->default_ascent = 0; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5955 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5956 /* Set global flag fonts_changed_p to non-zero if the font loaded |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5957 has a character with a smaller width than any other character |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5958 before, or if the font loaded has a smalle>r height than any |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5959 other font loaded before. If this happens, it will make a |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5960 glyph matrix reallocation necessary. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5961 fonts_changed_p = x_compute_min_glyph_bounds (f); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5962 UNBLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5963 return fontp; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5964 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5965 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5966 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5967 /* Load font named FONTNAME of size SIZE for frame F, and return a |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5968 pointer to the structure font_info while allocating it dynamically. |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5969 If loading fails, return NULL. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5970 struct font_info * |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5971 w32_load_font (f,fontname,size) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5972 struct frame *f; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5973 char * fontname; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5974 int size; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5975 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5976 Lisp_Object bdf_fonts; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5977 struct font_info *retval = NULL; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5978 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
5979 bdf_fonts = w32_list_bdf_fonts (build_string (fontname), 1); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5980 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5981 while (!retval && CONSP (bdf_fonts)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5982 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5983 char *bdf_name, *bdf_file; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5984 Lisp_Object bdf_pair; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5985 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
5986 bdf_name = XSTRING (XCAR (bdf_fonts))->data; |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
5987 bdf_pair = Fassoc (XCAR (bdf_fonts), Vw32_bdf_filename_alist); |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
5988 bdf_file = XSTRING (XCDR (bdf_pair))->data; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5989 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5990 retval = w32_load_bdf_font (f, bdf_name, size, bdf_file); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5991 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
5992 bdf_fonts = XCDR (bdf_fonts); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5993 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5994 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5995 if (retval) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5996 return retval; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5997 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5998 return w32_load_system_font(f, fontname, size); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5999 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6000 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6001 |
13434 | 6002 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6003 w32_unload_font (dpyinfo, font) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6004 struct w32_display_info *dpyinfo; |
13434 | 6005 XFontStruct * font; |
6006 { | |
6007 if (font) | |
6008 { | |
32721
0574ffc14f77
(w32_load_system_font): Call w32_cache_char_metrics.
Andrew Innes <andrewi@gnu.org>
parents:
32669
diff
changeset
|
6009 if (font->per_char) xfree (font->per_char); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6010 if (font->bdf) w32_free_bdf_font (font->bdf); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6011 |
14353 | 6012 if (font->hfont) DeleteObject(font->hfont); |
13434 | 6013 xfree (font); |
6014 } | |
6015 } | |
6016 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6017 /* The font conversion stuff between x and w32 */ |
13434 | 6018 |
6019 /* X font string is as follows (from faces.el) | |
6020 * (let ((- "[-?]") | |
6021 * (foundry "[^-]+") | |
6022 * (family "[^-]+") | |
6023 * (weight "\\(bold\\|demibold\\|medium\\)") ; 1 | |
6024 * (weight\? "\\([^-]*\\)") ; 1 | |
6025 * (slant "\\([ior]\\)") ; 2 | |
6026 * (slant\? "\\([^-]?\\)") ; 2 | |
6027 * (swidth "\\([^-]*\\)") ; 3 | |
6028 * (adstyle "[^-]*") ; 4 | |
6029 * (pixelsize "[0-9]+") | |
6030 * (pointsize "[0-9][0-9]+") | |
6031 * (resx "[0-9][0-9]+") | |
6032 * (resy "[0-9][0-9]+") | |
6033 * (spacing "[cmp?*]") | |
6034 * (avgwidth "[0-9]+") | |
6035 * (registry "[^-]+") | |
6036 * (encoding "[^-]+") | |
6037 * ) | |
6038 */ | |
6039 | |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6040 static LONG |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6041 x_to_w32_weight (lpw) |
13434 | 6042 char * lpw; |
6043 { | |
6044 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
|
6045 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6046 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
|
6047 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
|
6048 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
|
6049 else if (stricmp (lpw,"demibold") == 0) return FW_SEMIBOLD; |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
6050 else if (stricmp (lpw,"semibold") == 0) return FW_SEMIBOLD; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6051 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
|
6052 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
|
6053 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
|
6054 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
|
6055 else if (stricmp (lpw,"thin") == 0) return FW_THIN; |
13434 | 6056 else |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6057 return FW_DONTCARE; |
13434 | 6058 } |
6059 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6060 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6061 static char * |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6062 w32_to_x_weight (fnweight) |
13434 | 6063 int fnweight; |
6064 { | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6065 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
|
6066 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
|
6067 if (fnweight >= FW_BOLD) return "bold"; |
24856
07a04c532706
(w32_to_x_weight): Return "demibold" instead of "semibold".
Andrew Innes <andrewi@gnu.org>
parents:
24751
diff
changeset
|
6068 if (fnweight >= FW_SEMIBOLD) return "demibold"; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6069 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
|
6070 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
|
6071 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
|
6072 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
|
6073 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
|
6074 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6075 return "*"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6076 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6077 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6078 static LONG |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6079 x_to_w32_charset (lpcs) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6080 char * lpcs; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6081 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6082 Lisp_Object this_entry, w32_charset; |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6083 char *charset; |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6084 int len = strlen (lpcs); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6085 |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6086 /* Support "*-#nnn" format for unknown charsets. */ |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6087 if (strncmp (lpcs, "*-#", 3) == 0) |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6088 return atoi (lpcs + 3); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6089 |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6090 /* Handle wildcards by ignoring them; eg. treat "big5*-*" as "big5". */ |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6091 charset = alloca (len + 1); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6092 strcpy (charset, lpcs); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6093 lpcs = strchr (charset, '*'); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6094 if (lpcs) |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6095 *lpcs = 0; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6096 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6097 /* Look through w32-charset-info-alist for the character set. |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6098 Format of each entry is |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6099 (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)). |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6100 */ |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6101 this_entry = Fassoc (build_string(charset), Vw32_charset_info_alist); |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6102 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6103 if (NILP(this_entry)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6104 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6105 /* At startup, we want iso8859-1 fonts to come up properly. */ |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6106 if (stricmp(charset, "iso8859-1") == 0) |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6107 return ANSI_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6108 else |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6109 return DEFAULT_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6110 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6111 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6112 w32_charset = Fcar (Fcdr (this_entry)); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6113 |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6114 /* Translate Lisp symbol to number. */ |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6115 if (w32_charset == Qw32_charset_ansi) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6116 return ANSI_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6117 if (w32_charset == Qw32_charset_symbol) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6118 return SYMBOL_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6119 if (w32_charset == Qw32_charset_shiftjis) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6120 return SHIFTJIS_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6121 if (w32_charset == Qw32_charset_hangeul) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6122 return HANGEUL_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6123 if (w32_charset == Qw32_charset_chinesebig5) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6124 return CHINESEBIG5_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6125 if (w32_charset == Qw32_charset_gb2312) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6126 return GB2312_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6127 if (w32_charset == Qw32_charset_oem) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6128 return OEM_CHARSET; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6129 #ifdef JOHAB_CHARSET |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6130 if (w32_charset == Qw32_charset_johab) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6131 return JOHAB_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6132 if (w32_charset == Qw32_charset_easteurope) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6133 return EASTEUROPE_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6134 if (w32_charset == Qw32_charset_turkish) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6135 return TURKISH_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6136 if (w32_charset == Qw32_charset_baltic) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6137 return BALTIC_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6138 if (w32_charset == Qw32_charset_russian) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6139 return RUSSIAN_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6140 if (w32_charset == Qw32_charset_arabic) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6141 return ARABIC_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6142 if (w32_charset == Qw32_charset_greek) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6143 return GREEK_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6144 if (w32_charset == Qw32_charset_hebrew) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6145 return HEBREW_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6146 if (w32_charset == Qw32_charset_vietnamese) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6147 return VIETNAMESE_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6148 if (w32_charset == Qw32_charset_thai) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6149 return THAI_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6150 if (w32_charset == Qw32_charset_mac) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6151 return MAC_CHARSET; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6152 #endif /* JOHAB_CHARSET */ |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6153 #ifdef UNICODE_CHARSET |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6154 if (w32_charset == Qw32_charset_unicode) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6155 return UNICODE_CHARSET; |
24718
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
6156 #endif |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6157 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6158 return DEFAULT_CHARSET; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6159 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6160 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6161 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6162 static char * |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6163 w32_to_x_charset (fncharset) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6164 int fncharset; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6165 { |
40528
7fb50bbb61ad
(w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents:
40385
diff
changeset
|
6166 static char buf[32]; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6167 Lisp_Object charset_type; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6168 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6169 switch (fncharset) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6170 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6171 case ANSI_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6172 /* Handle startup case of w32-charset-info-alist not |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6173 being set up yet. */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6174 if (NILP(Vw32_charset_info_alist)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6175 return "iso8859-1"; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6176 charset_type = Qw32_charset_ansi; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6177 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6178 case DEFAULT_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6179 charset_type = Qw32_charset_default; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6180 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6181 case SYMBOL_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6182 charset_type = Qw32_charset_symbol; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6183 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6184 case SHIFTJIS_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6185 charset_type = Qw32_charset_shiftjis; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6186 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6187 case HANGEUL_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6188 charset_type = Qw32_charset_hangeul; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6189 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6190 case GB2312_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6191 charset_type = Qw32_charset_gb2312; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6192 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6193 case CHINESEBIG5_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6194 charset_type = Qw32_charset_chinesebig5; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6195 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6196 case OEM_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6197 charset_type = Qw32_charset_oem; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6198 break; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6199 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6200 /* More recent versions of Windows (95 and NT4.0) define more |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6201 character sets. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6202 #ifdef EASTEUROPE_CHARSET |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6203 case EASTEUROPE_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6204 charset_type = Qw32_charset_easteurope; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6205 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6206 case TURKISH_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6207 charset_type = Qw32_charset_turkish; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6208 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6209 case BALTIC_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6210 charset_type = Qw32_charset_baltic; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6211 break; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6212 case RUSSIAN_CHARSET: |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6213 charset_type = Qw32_charset_russian; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6214 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6215 case ARABIC_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6216 charset_type = Qw32_charset_arabic; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6217 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6218 case GREEK_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6219 charset_type = Qw32_charset_greek; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6220 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6221 case HEBREW_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6222 charset_type = Qw32_charset_hebrew; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6223 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6224 case VIETNAMESE_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6225 charset_type = Qw32_charset_vietnamese; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6226 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6227 case THAI_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6228 charset_type = Qw32_charset_thai; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6229 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6230 case MAC_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6231 charset_type = Qw32_charset_mac; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6232 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6233 case JOHAB_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6234 charset_type = Qw32_charset_johab; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6235 break; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6236 #endif |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6237 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6238 #ifdef UNICODE_CHARSET |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6239 case UNICODE_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6240 charset_type = Qw32_charset_unicode; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6241 break; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6242 #endif |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6243 default: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6244 /* Encode numerical value of unknown charset. */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6245 sprintf (buf, "*-#%u", fncharset); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6246 return buf; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6247 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6248 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6249 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6250 Lisp_Object rest; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6251 char * best_match = NULL; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6252 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6253 /* Look through w32-charset-info-alist for the character set. |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6254 Prefer ISO codepages, and prefer lower numbers in the ISO |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6255 range. Only return charsets for codepages which are installed. |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6256 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6257 Format of each entry is |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6258 (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)). |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6259 */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6260 for (rest = Vw32_charset_info_alist; CONSP (rest); rest = XCDR (rest)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6261 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6262 char * x_charset; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6263 Lisp_Object w32_charset; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6264 Lisp_Object codepage; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6265 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6266 Lisp_Object this_entry = XCAR (rest); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6267 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6268 /* Skip invalid entries in alist. */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6269 if (!CONSP (this_entry) || !STRINGP (XCAR (this_entry)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6270 || !CONSP (XCDR (this_entry)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6271 || !SYMBOLP (XCAR (XCDR (this_entry)))) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6272 continue; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6273 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6274 x_charset = XSTRING (XCAR (this_entry))->data; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6275 w32_charset = XCAR (XCDR (this_entry)); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6276 codepage = XCDR (XCDR (this_entry)); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6277 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6278 /* Look for Same charset and a valid codepage (or non-int |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6279 which means ignore). */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6280 if (w32_charset == charset_type |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6281 && (!INTEGERP (codepage) || codepage == CP_DEFAULT |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6282 || IsValidCodePage (XINT (codepage)))) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6283 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6284 /* If we don't have a match already, then this is the |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6285 best. */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6286 if (!best_match) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6287 best_match = x_charset; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6288 /* If this is an ISO codepage, and the best so far isn't, |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6289 then this is better. */ |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6290 else if (strnicmp (best_match, "iso", 3) != 0 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6291 && strnicmp (x_charset, "iso", 3) == 0) |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6292 best_match = x_charset; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6293 /* If both are ISO8859 codepages, choose the one with the |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6294 lowest number in the encoding field. */ |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6295 else if (strnicmp (best_match, "iso8859-", 8) == 0 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6296 && strnicmp (x_charset, "iso8859-", 8) == 0) |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6297 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6298 int best_enc = atoi (best_match + 8); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6299 int this_enc = atoi (x_charset + 8); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6300 if (this_enc > 0 && this_enc < best_enc) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6301 best_match = x_charset; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6302 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6303 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6304 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6305 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6306 /* If no match, encode the numeric value. */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6307 if (!best_match) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6308 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6309 sprintf (buf, "*-#%u", fncharset); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6310 return buf; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6311 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6312 |
40528
7fb50bbb61ad
(w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents:
40385
diff
changeset
|
6313 strncpy(buf, best_match, 31); |
7fb50bbb61ad
(w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents:
40385
diff
changeset
|
6314 buf[31] = '\0'; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6315 return buf; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6316 } |
13434 | 6317 } |
6318 | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6319 |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6320 /* Return all the X charsets that map to a font. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6321 static Lisp_Object |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6322 w32_to_all_x_charsets (fncharset) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6323 int fncharset; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6324 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6325 static char buf[32]; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6326 Lisp_Object charset_type; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6327 Lisp_Object retval = Qnil; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6328 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6329 switch (fncharset) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6330 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6331 case ANSI_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6332 /* Handle startup case of w32-charset-info-alist not |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6333 being set up yet. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6334 if (NILP(Vw32_charset_info_alist)) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6335 return "iso8859-1"; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6336 charset_type = Qw32_charset_ansi; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6337 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6338 case DEFAULT_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6339 charset_type = Qw32_charset_default; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6340 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6341 case SYMBOL_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6342 charset_type = Qw32_charset_symbol; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6343 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6344 case SHIFTJIS_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6345 charset_type = Qw32_charset_shiftjis; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6346 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6347 case HANGEUL_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6348 charset_type = Qw32_charset_hangeul; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6349 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6350 case GB2312_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6351 charset_type = Qw32_charset_gb2312; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6352 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6353 case CHINESEBIG5_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6354 charset_type = Qw32_charset_chinesebig5; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6355 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6356 case OEM_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6357 charset_type = Qw32_charset_oem; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6358 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6359 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6360 /* More recent versions of Windows (95 and NT4.0) define more |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6361 character sets. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6362 #ifdef EASTEUROPE_CHARSET |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6363 case EASTEUROPE_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6364 charset_type = Qw32_charset_easteurope; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6365 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6366 case TURKISH_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6367 charset_type = Qw32_charset_turkish; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6368 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6369 case BALTIC_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6370 charset_type = Qw32_charset_baltic; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6371 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6372 case RUSSIAN_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6373 charset_type = Qw32_charset_russian; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6374 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6375 case ARABIC_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6376 charset_type = Qw32_charset_arabic; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6377 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6378 case GREEK_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6379 charset_type = Qw32_charset_greek; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6380 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6381 case HEBREW_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6382 charset_type = Qw32_charset_hebrew; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6383 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6384 case VIETNAMESE_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6385 charset_type = Qw32_charset_vietnamese; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6386 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6387 case THAI_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6388 charset_type = Qw32_charset_thai; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6389 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6390 case MAC_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6391 charset_type = Qw32_charset_mac; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6392 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6393 case JOHAB_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6394 charset_type = Qw32_charset_johab; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6395 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6396 #endif |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6397 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6398 #ifdef UNICODE_CHARSET |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6399 case UNICODE_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6400 charset_type = Qw32_charset_unicode; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6401 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6402 #endif |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6403 default: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6404 /* Encode numerical value of unknown charset. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6405 sprintf (buf, "*-#%u", fncharset); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6406 return Fcons (build_string (buf), Qnil); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6407 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6408 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6409 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6410 Lisp_Object rest; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6411 /* Look through w32-charset-info-alist for the character set. |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6412 Only return charsets for codepages which are installed. |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6413 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6414 Format of each entry in Vw32_charset_info_alist is |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6415 (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)). |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6416 */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6417 for (rest = Vw32_charset_info_alist; CONSP (rest); rest = XCDR (rest)) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6418 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6419 Lisp_Object x_charset; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6420 Lisp_Object w32_charset; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6421 Lisp_Object codepage; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6422 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6423 Lisp_Object this_entry = XCAR (rest); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6424 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6425 /* Skip invalid entries in alist. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6426 if (!CONSP (this_entry) || !STRINGP (XCAR (this_entry)) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6427 || !CONSP (XCDR (this_entry)) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6428 || !SYMBOLP (XCAR (XCDR (this_entry)))) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6429 continue; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6430 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6431 x_charset = XCAR (this_entry); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6432 w32_charset = XCAR (XCDR (this_entry)); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6433 codepage = XCDR (XCDR (this_entry)); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6434 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6435 /* Look for Same charset and a valid codepage (or non-int |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6436 which means ignore). */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6437 if (w32_charset == charset_type |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6438 && (!INTEGERP (codepage) || codepage == CP_DEFAULT |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6439 || IsValidCodePage (XINT (codepage)))) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6440 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6441 retval = Fcons (x_charset, retval); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6442 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6443 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6444 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6445 /* If no match, encode the numeric value. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6446 if (NILP (retval)) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6447 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6448 sprintf (buf, "*-#%u", fncharset); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6449 return Fcons (build_string (buf), Qnil); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6450 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6451 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6452 return retval; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6453 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6454 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6455 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6456 /* Get the Windows codepage corresponding to the specified font. The |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6457 charset info in the font name is used to look up |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6458 w32-charset-to-codepage-alist. */ |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6459 int |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6460 w32_codepage_for_font (char *fontname) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6461 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6462 Lisp_Object codepage, entry; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6463 char *charset_str, *charset, *end; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6464 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6465 if (NILP (Vw32_charset_info_alist)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6466 return CP_DEFAULT; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6467 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6468 /* Extract charset part of font string. */ |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6469 charset = xlfd_charset_of_font (fontname); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6470 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6471 if (!charset) |
34284
3a21ff35392b
(xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents:
34133
diff
changeset
|
6472 return CP_UNKNOWN; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6473 |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6474 charset_str = (char *) alloca (strlen (charset) + 1); |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6475 strcpy (charset_str, charset); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6476 |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6477 #if 0 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6478 /* Remove leading "*-". */ |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6479 if (strncmp ("*-", charset_str, 2) == 0) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6480 charset = charset_str + 2; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6481 else |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6482 #endif |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6483 charset = charset_str; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6484 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6485 /* Stop match at wildcard (including preceding '-'). */ |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6486 if (end = strchr (charset, '*')) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6487 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6488 if (end > charset && *(end-1) == '-') |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6489 end--; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6490 *end = '\0'; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6491 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6492 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6493 entry = Fassoc (build_string(charset), Vw32_charset_info_alist); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6494 if (NILP (entry)) |
34284
3a21ff35392b
(xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents:
34133
diff
changeset
|
6495 return CP_UNKNOWN; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6496 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6497 codepage = Fcdr (Fcdr (entry)); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6498 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6499 if (NILP (codepage)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6500 return CP_8BIT; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6501 else if (XFASTINT (codepage) == XFASTINT (Qt)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6502 return CP_UNICODE; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6503 else if (INTEGERP (codepage)) |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6504 return XINT (codepage); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6505 else |
34284
3a21ff35392b
(xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents:
34133
diff
changeset
|
6506 return CP_UNKNOWN; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6507 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6508 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6509 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6510 static BOOL |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6511 w32_to_x_font (lplogfont, lpxstr, len, specific_charset) |
13434 | 6512 LOGFONT * lplogfont; |
6513 char * lpxstr; | |
6514 int len; | |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6515 char * specific_charset; |
13434 | 6516 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6517 char* fonttype; |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6518 char *fontname; |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6519 char height_pixels[8]; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6520 char height_dpi[8]; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6521 char width_pixels[8]; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6522 char *fontname_dash; |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6523 int display_resy = one_w32_display_info.resy; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6524 int display_resx = one_w32_display_info.resx; |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6525 int bufsz; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6526 struct coding_system coding; |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6527 |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6528 if (!lpxstr) abort (); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6529 |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6530 if (!lplogfont) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6531 return FALSE; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6532 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6533 if (lplogfont->lfOutPrecision == OUT_STRING_PRECIS) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6534 fonttype = "raster"; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6535 else if (lplogfont->lfOutPrecision == OUT_STROKE_PRECIS) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6536 fonttype = "outline"; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6537 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6538 fonttype = "unknown"; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6539 |
41322
482c520b29ba
(Vw32_system_coding_system): Remove.
Jason Rumney <jasonr@gnu.org>
parents:
41250
diff
changeset
|
6540 setup_coding_system (Fcheck_coding_system (Vlocale_coding_system), |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6541 &coding); |
29021
be2769eac1a5
(w32_to_x_font): Setup members src_multibyte and
Kenichi Handa <handa@m17n.org>
parents:
28983
diff
changeset
|
6542 coding.src_multibyte = 0; |
be2769eac1a5
(w32_to_x_font): Setup members src_multibyte and
Kenichi Handa <handa@m17n.org>
parents:
28983
diff
changeset
|
6543 coding.dst_multibyte = 1; |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6544 coding.mode |= CODING_MODE_LAST_BLOCK; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6545 bufsz = decoding_buffer_size (&coding, LF_FACESIZE); |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6546 |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6547 fontname = alloca(sizeof(*fontname) * bufsz); |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6548 decode_coding (&coding, lplogfont->lfFaceName, fontname, |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6549 strlen(lplogfont->lfFaceName), bufsz - 1); |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6550 *(fontname + coding.produced) = '\0'; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6551 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6552 /* Replace dashes with underscores so the dashes are not |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6553 misinterpreted. */ |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6554 fontname_dash = fontname; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6555 while (fontname_dash = strchr (fontname_dash, '-')) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6556 *fontname_dash = '_'; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6557 |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6558 if (lplogfont->lfHeight) |
13434 | 6559 { |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6560 sprintf (height_pixels, "%u", abs (lplogfont->lfHeight)); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6561 sprintf (height_dpi, "%u", |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6562 abs (lplogfont->lfHeight) * 720 / display_resy); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6563 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6564 else |
13434 | 6565 { |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6566 strcpy (height_pixels, "*"); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6567 strcpy (height_dpi, "*"); |
13434 | 6568 } |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6569 if (lplogfont->lfWidth) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6570 sprintf (width_pixels, "%u", lplogfont->lfWidth * 10); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6571 else |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6572 strcpy (width_pixels, "*"); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6573 |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6574 _snprintf (lpxstr, len - 1, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6575 "-%s-%s-%s-%c-normal-normal-%s-%s-%d-%d-%c-%s-%s", |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6576 fonttype, /* foundry */ |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6577 fontname, /* family */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6578 w32_to_x_weight (lplogfont->lfWeight), /* weight */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6579 lplogfont->lfItalic?'i':'r', /* slant */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6580 /* setwidth name */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6581 /* add style name */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6582 height_pixels, /* pixel size */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6583 height_dpi, /* point size */ |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6584 display_resx, /* resx */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6585 display_resy, /* resy */ |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6586 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6587 ? 'p' : 'c', /* spacing */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6588 width_pixels, /* avg width */ |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6589 specific_charset ? specific_charset |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6590 : w32_to_x_charset (lplogfont->lfCharSet) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6591 /* charset registry and encoding */ |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6592 ); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6593 |
13434 | 6594 lpxstr[len - 1] = 0; /* just to be sure */ |
6595 return (TRUE); | |
6596 } | |
6597 | |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6598 static BOOL |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6599 x_to_w32_font (lpxstr, lplogfont) |
13434 | 6600 char * lpxstr; |
6601 LOGFONT * lplogfont; | |
6602 { | |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6603 struct coding_system coding; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6604 |
13434 | 6605 if (!lplogfont) return (FALSE); |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6606 |
13434 | 6607 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
|
6608 |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
6609 /* Set default value for each field. */ |
15380
8b01836a6b06
(x_to_win32_font): Allow any quality fonts.
Richard M. Stallman <rms@gnu.org>
parents:
15377
diff
changeset
|
6610 #if 1 |
13434 | 6611 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS; |
6612 lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS; | |
6613 lplogfont->lfQuality = DEFAULT_QUALITY; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6614 #else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6615 /* go for maximum quality */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6616 lplogfont->lfOutPrecision = OUT_STROKE_PRECIS; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6617 lplogfont->lfClipPrecision = CLIP_STROKE_PRECIS; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6618 lplogfont->lfQuality = PROOF_QUALITY; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6619 #endif |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6620 |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
6621 lplogfont->lfCharSet = DEFAULT_CHARSET; |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
6622 lplogfont->lfWeight = FW_DONTCARE; |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
6623 lplogfont->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
6624 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6625 if (!lpxstr) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6626 return FALSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6627 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6628 /* 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
|
6629 * 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
|
6630 * format: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6631 * "<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
|
6632 */ |
13434 | 6633 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6634 if (*lpxstr == '-') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6635 { |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6636 int fields, tem; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6637 char name[50], weight[20], slant, pitch, pixels[10], height[10], |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6638 width[10], resy[10], remainder[50]; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6639 char * encoding; |
32791
43fa65d08292
(x_to_w32_font): Initialize dpi from dpyinfo->resy.
Jason Rumney <jasonr@gnu.org>
parents:
32721
diff
changeset
|
6640 int dpi = one_w32_display_info.resy; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6641 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6642 fields = sscanf (lpxstr, |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6643 "-%*[^-]-%49[^-]-%19[^-]-%c-%*[^-]-%*[^-]-%9[^-]-%9[^-]-%*[^-]-%9[^-]-%c-%9[^-]-%49s", |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6644 name, weight, &slant, pixels, height, resy, &pitch, width, remainder); |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6645 if (fields == EOF) |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6646 return (FALSE); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6647 |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6648 /* In the general case when wildcards cover more than one field, |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6649 we don't know which field is which, so don't fill any in. |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6650 However, we need to cope with this particular form, which is |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6651 generated by font_list_1 (invoked by try_font_list): |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6652 "-raster-6x10-*-gb2312*-*" |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6653 and make sure to correctly parse the charset field. */ |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6654 if (fields == 3) |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6655 { |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6656 fields = sscanf (lpxstr, |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6657 "-%*[^-]-%49[^-]-*-%49s", |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6658 name, remainder); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6659 } |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6660 else if (fields < 9) |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6661 { |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6662 fields = 0; |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6663 remainder[0] = 0; |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6664 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6665 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6666 if (fields > 0 && name[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6667 { |
24583
0e5c5bd9b99d
(x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents:
24497
diff
changeset
|
6668 int bufsize; |
0e5c5bd9b99d
(x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents:
24497
diff
changeset
|
6669 unsigned char *buf; |
0e5c5bd9b99d
(x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents:
24497
diff
changeset
|
6670 |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6671 setup_coding_system |
41322
482c520b29ba
(Vw32_system_coding_system): Remove.
Jason Rumney <jasonr@gnu.org>
parents:
41250
diff
changeset
|
6672 (Fcheck_coding_system (Vlocale_coding_system), &coding); |
29021
be2769eac1a5
(w32_to_x_font): Setup members src_multibyte and
Kenichi Handa <handa@m17n.org>
parents:
28983
diff
changeset
|
6673 coding.src_multibyte = 1; |
be2769eac1a5
(w32_to_x_font): Setup members src_multibyte and
Kenichi Handa <handa@m17n.org>
parents:
28983
diff
changeset
|
6674 coding.dst_multibyte = 1; |
24583
0e5c5bd9b99d
(x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents:
24497
diff
changeset
|
6675 bufsize = encoding_buffer_size (&coding, strlen (name)); |
0e5c5bd9b99d
(x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents:
24497
diff
changeset
|
6676 buf = (unsigned char *) alloca (bufsize); |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6677 coding.mode |= CODING_MODE_LAST_BLOCK; |
24583
0e5c5bd9b99d
(x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents:
24497
diff
changeset
|
6678 encode_coding (&coding, name, buf, strlen (name), bufsize); |
0e5c5bd9b99d
(x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents:
24497
diff
changeset
|
6679 if (coding.produced >= LF_FACESIZE) |
0e5c5bd9b99d
(x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents:
24497
diff
changeset
|
6680 coding.produced = LF_FACESIZE - 1; |
0e5c5bd9b99d
(x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents:
24497
diff
changeset
|
6681 buf[coding.produced] = 0; |
0e5c5bd9b99d
(x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
Richard M. Stallman <rms@gnu.org>
parents:
24497
diff
changeset
|
6682 strcpy (lplogfont->lfFaceName, buf); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6683 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6684 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6685 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6686 lplogfont->lfFaceName[0] = '\0'; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6687 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6688 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6689 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6690 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6691 lplogfont->lfWeight = x_to_w32_weight ((fields > 0 ? weight : "")); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6692 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6693 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6694 |
33879
9bbea0dda9cd
(x_to_w32_font): Do not filter out italic fonts, as new
Jason Rumney <jasonr@gnu.org>
parents:
33870
diff
changeset
|
6695 lplogfont->lfItalic = (fields > 0 && slant == 'i'); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6696 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6697 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6698 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6699 if (fields > 0 && pixels[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6700 lplogfont->lfHeight = atoi (pixels); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6701 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6702 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6703 fields--; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6704 if (fields > 0 && resy[0] != '*') |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6705 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6706 tem = atoi (resy); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6707 if (tem > 0) dpi = tem; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6708 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6709 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6710 if (fields > -1 && lplogfont->lfHeight == 0 && height[0] != '*') |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6711 lplogfont->lfHeight = atoi (height) * dpi / 720; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6712 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6713 if (fields > 0) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6714 lplogfont->lfPitchAndFamily = |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6715 (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
|
6716 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6717 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6718 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6719 if (fields > 0 && width[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6720 lplogfont->lfWidth = atoi (width) / 10; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6721 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6722 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6723 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6724 /* Strip the trailing '-' if present. (it shouldn't be, as it |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6725 fails the test against xlfd-tight-regexp in fontset.el). */ |
14353 | 6726 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6727 int len = strlen (remainder); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6728 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
|
6729 remainder[len-1] = 0; |
13434 | 6730 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6731 encoding = remainder; |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6732 #if 0 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6733 if (strncmp (encoding, "*-", 2) == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6734 encoding += 2; |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6735 #endif |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6736 lplogfont->lfCharSet = x_to_w32_charset (encoding); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6737 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6738 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6739 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6740 int fields; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6741 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
|
6742 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6743 fields = sscanf (lpxstr, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6744 "%99[^:]:%9[^:]:%9[^:]:%19s", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6745 name, height, width, weight); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6746 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6747 if (fields == EOF) return (FALSE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6748 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6749 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6750 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6751 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
|
6752 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
|
6753 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6754 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6755 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6756 lplogfont->lfFaceName[0] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6757 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6758 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6759 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6760 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6761 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6762 lplogfont->lfHeight = atoi (height); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6763 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6764 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6765 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6766 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6767 lplogfont->lfWidth = atoi (width); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6768 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6769 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6770 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6771 lplogfont->lfWeight = x_to_w32_weight ((fields > 0 ? weight : "")); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6772 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6773 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6774 /* 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
|
6775 lplogfont->lfHeight = - abs (lplogfont->lfHeight); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6776 |
13434 | 6777 return (TRUE); |
6778 } | |
6779 | |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6780 /* Strip the pixel height and point height from the given xlfd, and |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6781 return the pixel height. If no pixel height is specified, calculate |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6782 one from the point height, or if that isn't defined either, return |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6783 0 (which usually signifies a scalable font). |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6784 */ |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6785 static int |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6786 xlfd_strip_height (char *fontname) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6787 { |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6788 int pixel_height, field_number; |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6789 char *read_from, *write_to; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6790 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6791 xassert (fontname); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6792 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6793 pixel_height = field_number = 0; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6794 write_to = NULL; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6795 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6796 /* Look for height fields. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6797 for (read_from = fontname; *read_from; read_from++) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6798 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6799 if (*read_from == '-') |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6800 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6801 field_number++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6802 if (field_number == 7) /* Pixel height. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6803 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6804 read_from++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6805 write_to = read_from; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6806 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6807 /* Find end of field. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6808 for (;*read_from && *read_from != '-'; read_from++) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6809 ; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6810 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6811 /* Split the fontname at end of field. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6812 if (*read_from) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6813 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6814 *read_from = '\0'; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6815 read_from++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6816 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6817 pixel_height = atoi (write_to); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6818 /* Blank out field. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6819 if (read_from > write_to) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6820 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6821 *write_to = '-'; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6822 write_to++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6823 } |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6824 /* If the pixel height field is at the end (partial xlfd), |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6825 return now. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6826 else |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6827 return pixel_height; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6828 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6829 /* If we got a pixel height, the point height can be |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6830 ignored. Just blank it out and break now. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6831 if (pixel_height) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6832 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6833 /* Find end of point size field. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6834 for (; *read_from && *read_from != '-'; read_from++) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6835 ; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6836 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6837 if (*read_from) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6838 read_from++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6839 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6840 /* Blank out the point size field. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6841 if (read_from > write_to) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6842 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6843 *write_to = '-'; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6844 write_to++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6845 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6846 else |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6847 return pixel_height; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6848 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6849 break; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6850 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6851 /* If the point height is already blank, break now. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6852 if (*read_from == '-') |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6853 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6854 read_from++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6855 break; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6856 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6857 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6858 else if (field_number == 8) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6859 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6860 /* If we didn't get a pixel height, try to get the point |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6861 height and convert that. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6862 int point_size; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6863 char *point_size_start = read_from++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6864 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6865 /* Find end of field. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6866 for (; *read_from && *read_from != '-'; read_from++) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6867 ; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6868 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6869 if (*read_from) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6870 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6871 *read_from = '\0'; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6872 read_from++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6873 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6874 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6875 point_size = atoi (point_size_start); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6876 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6877 /* Convert to pixel height. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6878 pixel_height = point_size |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6879 * one_w32_display_info.height_in / 720; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6880 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6881 /* Blank out this field and break. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6882 *write_to = '-'; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6883 write_to++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6884 break; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6885 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6886 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6887 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6888 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6889 /* Shift the rest of the font spec into place. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6890 if (write_to && read_from > write_to) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6891 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6892 for (; *read_from; read_from++, write_to++) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6893 *write_to = *read_from; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6894 *write_to = '\0'; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6895 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6896 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6897 return pixel_height; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6898 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6899 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6900 /* Assume parameter 1 is fully qualified, no wildcards. */ |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6901 static BOOL |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6902 w32_font_match (fontname, pattern) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6903 char * fontname; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6904 char * pattern; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6905 { |
35674
62b578dd28ce
(w32_font_match): Allocate three more bytes to regex
Kenichi Handa <handa@m17n.org>
parents:
35359
diff
changeset
|
6906 char *regex = alloca (strlen (pattern) * 2 + 3); |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6907 char *font_name_copy = alloca (strlen (fontname) + 1); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6908 char *ptr; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6909 |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6910 /* Copy fontname so we can modify it during comparison. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6911 strcpy (font_name_copy, fontname); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6912 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6913 ptr = regex; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6914 *ptr++ = '^'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6915 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6916 /* Turn pattern into a regexp and do a regexp match. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6917 for (; *pattern; pattern++) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6918 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6919 if (*pattern == '?') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6920 *ptr++ = '.'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6921 else if (*pattern == '*') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6922 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6923 *ptr++ = '.'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6924 *ptr++ = '*'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6925 } |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6926 else |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6927 *ptr++ = *pattern; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6928 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6929 *ptr = '$'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6930 *(ptr + 1) = '\0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6931 |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6932 /* Strip out font heights and compare them seperately, since |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6933 rounding error can cause mismatches. This also allows a |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6934 comparison between a font that declares only a pixel height and a |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6935 pattern that declares the point height. |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6936 */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6937 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6938 int font_height, pattern_height; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6939 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6940 font_height = xlfd_strip_height (font_name_copy); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6941 pattern_height = xlfd_strip_height (regex); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6942 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6943 /* Compare now, and don't bother doing expensive regexp matching |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6944 if the heights differ. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6945 if (font_height && pattern_height && (font_height != pattern_height)) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6946 return FALSE; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6947 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6948 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6949 return (fast_c_string_match_ignore_case (build_string (regex), |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6950 font_name_copy) >= 0); |
13434 | 6951 } |
6952 | |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6953 /* Callback functions, and a structure holding info they need, for |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6954 listing system fonts on W32. We need one set of functions to do the |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6955 job properly, but these don't work on NT 3.51 and earlier, so we |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6956 have a second set which don't handle character sets properly to |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6957 fall back on. |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6958 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6959 In both cases, there are two passes made. The first pass gets one |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6960 font from each family, the second pass lists all the fonts from |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6961 each family. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
6962 |
13434 | 6963 typedef struct enumfont_t |
6964 { | |
6965 HDC hdc; | |
6966 int numFonts; | |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6967 LOGFONT logfont; |
13434 | 6968 XFontStruct *size_ref; |
6969 Lisp_Object *pattern; | |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6970 Lisp_Object list; |
13434 | 6971 Lisp_Object *tail; |
6972 } enumfont_t; | |
6973 | |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6974 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6975 static void |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6976 enum_font_maybe_add_to_list (enumfont_t *, LOGFONT *, char *, Lisp_Object); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6977 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6978 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6979 static int CALLBACK |
13434 | 6980 enum_font_cb2 (lplf, lptm, FontType, lpef) |
6981 ENUMLOGFONT * lplf; | |
6982 NEWTEXTMETRIC * lptm; | |
6983 int FontType; | |
6984 enumfont_t * lpef; | |
6985 { | |
40873
f288d1d604a7
(enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
6986 /* Ignore struck out and underlined versions of fonts. */ |
f288d1d604a7
(enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
6987 if (lplf->elfLogFont.lfStrikeOut || lplf->elfLogFont.lfUnderline) |
f288d1d604a7
(enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
6988 return 1; |
f288d1d604a7
(enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
6989 |
f288d1d604a7
(enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
6990 /* Only return fonts with names starting with @ if they were |
f288d1d604a7
(enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
6991 explicitly specified, since Microsoft uses an initial @ to |
f288d1d604a7
(enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
6992 denote fonts for vertical writing, without providing a more |
f288d1d604a7
(enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
6993 convenient way of identifying them. */ |
f288d1d604a7
(enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
6994 if (lplf->elfLogFont.lfFaceName[0] == '@' |
f288d1d604a7
(enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
6995 && lpef->logfont.lfFaceName[0] != '@') |
40528
7fb50bbb61ad
(w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents:
40385
diff
changeset
|
6996 return 1; |
7fb50bbb61ad
(w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents:
40385
diff
changeset
|
6997 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6998 /* Check that the character set matches if it was specified */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6999 if (lpef->logfont.lfCharSet != DEFAULT_CHARSET && |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7000 lplf->elfLogFont.lfCharSet != lpef->logfont.lfCharSet) |
40528
7fb50bbb61ad
(w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents:
40385
diff
changeset
|
7001 return 1; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7002 |
13434 | 7003 { |
7004 char buf[100]; | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7005 Lisp_Object width = Qnil; |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7006 Lisp_Object charset_list = Qnil; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7007 char *charset = NULL; |
13434 | 7008 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7009 /* Truetype fonts do not report their true metrics until loaded */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7010 if (FontType != RASTER_FONTTYPE) |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
7011 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7012 if (!NILP (*(lpef->pattern))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7013 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7014 /* Scalable fonts are as big as you want them to be. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7015 lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7016 lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7017 width = make_number (lpef->logfont.lfWidth); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7018 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7019 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7020 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7021 lplf->elfLogFont.lfHeight = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7022 lplf->elfLogFont.lfWidth = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7023 } |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
7024 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7025 |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
7026 /* Make sure the height used here is the same as everywhere |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
7027 else (ie character height, not cell height). */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7028 if (lplf->elfLogFont.lfHeight > 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7029 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7030 /* lptm can be trusted for RASTER fonts, but not scalable ones. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7031 if (FontType == RASTER_FONTTYPE) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7032 lplf->elfLogFont.lfHeight = lptm->tmInternalLeading - lptm->tmHeight; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7033 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7034 lplf->elfLogFont.lfHeight = -lplf->elfLogFont.lfHeight; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7035 } |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7036 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7037 if (!NILP (*(lpef->pattern))) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7038 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7039 charset = xlfd_charset_of_font (XSTRING(*(lpef->pattern))->data); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7040 |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7041 /* Ensure that charset is valid for this font. |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7042 Continue if invalid in case charset contains a wildcard. */ |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7043 if (charset |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7044 && (x_to_w32_charset (charset) != lplf->elfLogFont.lfCharSet)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7045 charset = NULL; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7046 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7047 |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7048 if (charset) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7049 charset_list = Fcons (build_string (charset), Qnil); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7050 else |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7051 charset_list = w32_to_all_x_charsets (lplf->elfLogFont.lfCharSet); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7052 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7053 /* Loop through the charsets. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7054 for ( ; CONSP (charset_list); charset_list = Fcdr (charset_list)) |
13434 | 7055 { |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7056 Lisp_Object this_charset = Fcar (charset_list); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7057 charset = XSTRING (this_charset)->data; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7058 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7059 /* List bold and italic variations if w32-enable-synthesized-fonts |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7060 is non-nil and this is a plain font. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7061 if (w32_enable_synthesized_fonts |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7062 && lplf->elfLogFont.lfWeight == FW_NORMAL |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7063 && lplf->elfLogFont.lfItalic == FALSE) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7064 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7065 enum_font_maybe_add_to_list (lpef, &(lplf->elfLogFont), |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7066 charset, width); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7067 /* bold. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7068 lplf->elfLogFont.lfWeight = FW_BOLD; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7069 enum_font_maybe_add_to_list (lpef, &(lplf->elfLogFont), |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7070 charset, width); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7071 /* bold italic. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7072 lplf->elfLogFont.lfItalic = TRUE; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7073 enum_font_maybe_add_to_list (lpef, &(lplf->elfLogFont), |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7074 charset, width); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7075 /* italic. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7076 lplf->elfLogFont.lfWeight = FW_NORMAL; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7077 enum_font_maybe_add_to_list (lpef, &(lplf->elfLogFont), |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7078 charset, width); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7079 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7080 else |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7081 enum_font_maybe_add_to_list (lpef, &(lplf->elfLogFont), |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7082 charset, width); |
13434 | 7083 } |
7084 } | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7085 |
40528
7fb50bbb61ad
(w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents:
40385
diff
changeset
|
7086 return 1; |
13434 | 7087 } |
7088 | |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7089 static void |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7090 enum_font_maybe_add_to_list (lpef, logfont, match_charset, width) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7091 enumfont_t * lpef; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7092 LOGFONT * logfont; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7093 char * match_charset; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7094 Lisp_Object width; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7095 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7096 char buf[100]; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7097 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7098 if (!w32_to_x_font (logfont, buf, 100, match_charset)) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7099 return; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7100 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7101 if (NILP (*(lpef->pattern)) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7102 || w32_font_match (buf, XSTRING (*(lpef->pattern))->data)) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7103 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7104 /* Check if we already listed this font. This may happen if |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7105 w32_enable_synthesized_fonts is non-nil, and there are real |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7106 bold and italic versions of the font. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7107 Lisp_Object font_name = build_string (buf); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7108 if (NILP (Fmember (font_name, lpef->list))) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7109 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7110 *lpef->tail = Fcons (Fcons (build_string (buf), width), Qnil); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7111 lpef->tail = &(XCDR (*lpef->tail)); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7112 lpef->numFonts++; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7113 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7114 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7115 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7116 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7117 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7118 static int CALLBACK |
13434 | 7119 enum_font_cb1 (lplf, lptm, FontType, lpef) |
7120 ENUMLOGFONT * lplf; | |
7121 NEWTEXTMETRIC * lptm; | |
7122 int FontType; | |
7123 enumfont_t * lpef; | |
7124 { | |
7125 return EnumFontFamilies (lpef->hdc, | |
7126 lplf->elfLogFont.lfFaceName, | |
7127 (FONTENUMPROC) enum_font_cb2, | |
7128 (LPARAM) lpef); | |
7129 } | |
7130 | |
7131 | |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7132 static int CALLBACK |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7133 enum_fontex_cb2 (lplf, lptm, font_type, lpef) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7134 ENUMLOGFONTEX * lplf; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7135 NEWTEXTMETRICEX * lptm; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7136 int font_type; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7137 enumfont_t * lpef; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7138 { |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7139 /* We are not interested in the extra info we get back from the 'Ex |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7140 version - only the fact that we get character set variations |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7141 enumerated seperately. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7142 return enum_font_cb2 ((ENUMLOGFONT *) lplf, (NEWTEXTMETRIC *) lptm, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7143 font_type, lpef); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7144 } |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7145 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7146 static int CALLBACK |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7147 enum_fontex_cb1 (lplf, lptm, font_type, lpef) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7148 ENUMLOGFONTEX * lplf; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7149 NEWTEXTMETRICEX * lptm; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7150 int font_type; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7151 enumfont_t * lpef; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7152 { |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7153 HMODULE gdi32 = GetModuleHandle ("gdi32.dll"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7154 FARPROC enum_font_families_ex |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7155 = GetProcAddress ( gdi32, "EnumFontFamiliesExA"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7156 /* We don't really expect EnumFontFamiliesEx to disappear once we |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7157 get here, so don't bother handling it gracefully. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7158 if (enum_font_families_ex == NULL) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7159 error ("gdi32.dll has disappeared!"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7160 return enum_font_families_ex (lpef->hdc, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7161 &lplf->elfLogFont, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7162 (FONTENUMPROC) enum_fontex_cb2, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7163 (LPARAM) lpef, 0); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7164 } |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7165 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7166 /* Interface to fontset handler. (adapted from mw32font.c in Meadow |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7167 and xterm.c in Emacs 20.3) */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7168 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7169 static Lisp_Object w32_list_bdf_fonts (Lisp_Object pattern, int max_names) |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7170 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7171 char *fontname, *ptnstr; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7172 Lisp_Object list, tem, newlist = Qnil; |
24670 | 7173 int n_fonts = 0; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7174 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7175 list = Vw32_bdf_filename_alist; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7176 ptnstr = XSTRING (pattern)->data; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7177 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7178 for ( ; CONSP (list); list = XCDR (list)) |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7179 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7180 tem = XCAR (list); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7181 if (CONSP (tem)) |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7182 fontname = XSTRING (XCAR (tem))->data; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7183 else if (STRINGP (tem)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7184 fontname = XSTRING (tem)->data; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7185 else |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7186 continue; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7187 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7188 if (w32_font_match (fontname, ptnstr)) |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7189 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7190 newlist = Fcons (XCAR (tem), newlist); |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7191 n_fonts++; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7192 if (n_fonts >= max_names) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7193 break; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7194 } |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7195 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7196 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7197 return newlist; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7198 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7199 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7200 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7201 /* Return a list of names of available fonts matching PATTERN on frame |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7202 F. If SIZE is not 0, it is the size (maximum bound width) of fonts |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7203 to be listed. Frame F NULL means we have not yet created any |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7204 frame, which means we can't get proper size info, as we don't have |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7205 a device context to use for GetTextMetrics. |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7206 MAXNAMES sets a limit on how many fonts to match. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7207 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7208 Lisp_Object |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
7209 w32_list_fonts (f, pattern, size, maxnames) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
7210 struct frame *f; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
7211 Lisp_Object pattern; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
7212 int size; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
7213 int maxnames; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7214 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7215 Lisp_Object patterns, key = Qnil, tem, tpat; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7216 Lisp_Object list = Qnil, newlist = Qnil, second_best = Qnil; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7217 struct w32_display_info *dpyinfo = &one_w32_display_info; |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7218 int n_fonts = 0; |
23637
54b22e0a1f7b
(w32_list_fonts): Report an error if a frame has not
Geoff Voelker <voelker@cs.washington.edu>
parents:
23620
diff
changeset
|
7219 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7220 patterns = Fassoc (pattern, Valternate_fontname_alist); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7221 if (NILP (patterns)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7222 patterns = Fcons (pattern, Qnil); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7223 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7224 for (; CONSP (patterns); patterns = XCDR (patterns)) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7225 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7226 enumfont_t ef; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7227 int codepage; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7228 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7229 tpat = XCAR (patterns); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7230 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7231 if (!STRINGP (tpat)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7232 continue; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7233 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7234 /* Avoid expensive EnumFontFamilies functions if we are not |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7235 going to be able to output one of these anyway. */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7236 codepage = w32_codepage_for_font (XSTRING (tpat)->data); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7237 if (codepage != CP_8BIT && codepage != CP_UNICODE |
34284
3a21ff35392b
(xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents:
34133
diff
changeset
|
7238 && codepage != CP_DEFAULT && codepage != CP_UNKNOWN |
3a21ff35392b
(xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents:
34133
diff
changeset
|
7239 && !IsValidCodePage(codepage)) |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7240 continue; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7241 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7242 /* See if we cached the result for this particular query. |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7243 The cache is an alist of the form: |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7244 ((PATTERN (FONTNAME . WIDTH) ...) ...) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7245 */ |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7246 if (tem = XCDR (dpyinfo->name_list_element), |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7247 !NILP (list = Fassoc (tpat, tem))) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7248 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7249 list = Fcdr_safe (list); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7250 /* We have a cached list. Don't have to get the list again. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7251 goto label_cached; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7252 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7253 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7254 BLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7255 /* At first, put PATTERN in the cache. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7256 list = Qnil; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7257 ef.pattern = &tpat; |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7258 ef.list = list; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7259 ef.tail = &list; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7260 ef.numFonts = 0; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7261 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7262 /* Use EnumFontFamiliesEx where it is available, as it knows |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7263 about character sets. Fall back to EnumFontFamilies for |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7264 older versions of NT that don't support the 'Ex function. */ |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7265 x_to_w32_font (XSTRING (tpat)->data, &ef.logfont); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7266 { |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7267 LOGFONT font_match_pattern; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7268 HMODULE gdi32 = GetModuleHandle ("gdi32.dll"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7269 FARPROC enum_font_families_ex |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7270 = GetProcAddress ( gdi32, "EnumFontFamiliesExA"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7271 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7272 /* We do our own pattern matching so we can handle wildcards. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7273 font_match_pattern.lfFaceName[0] = 0; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7274 font_match_pattern.lfPitchAndFamily = 0; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7275 /* We can use the charset, because if it is a wildcard it will |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7276 be DEFAULT_CHARSET anyway. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7277 font_match_pattern.lfCharSet = ef.logfont.lfCharSet; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7278 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7279 ef.hdc = GetDC (dpyinfo->root_window); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7280 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7281 if (enum_font_families_ex) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7282 enum_font_families_ex (ef.hdc, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7283 &font_match_pattern, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7284 (FONTENUMPROC) enum_fontex_cb1, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7285 (LPARAM) &ef, 0); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7286 else |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7287 EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7288 (LPARAM)&ef); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7289 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7290 ReleaseDC (dpyinfo->root_window, ef.hdc); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7291 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7292 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7293 UNBLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7294 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7295 /* Make a list of the fonts we got back. |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7296 Store that in the font cache for the display. */ |
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
39812
diff
changeset
|
7297 XSETCDR (dpyinfo->name_list_element, |
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
39812
diff
changeset
|
7298 Fcons (Fcons (tpat, list), |
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
39812
diff
changeset
|
7299 XCDR (dpyinfo->name_list_element))); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7300 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7301 label_cached: |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7302 if (NILP (list)) continue; /* Try the remaining alternatives. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7303 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7304 newlist = second_best = Qnil; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7305 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7306 /* Make a list of the fonts that have the right width. */ |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7307 for (; CONSP (list); list = XCDR (list)) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7308 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7309 int found_size; |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7310 tem = XCAR (list); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7311 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7312 if (!CONSP (tem)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7313 continue; |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7314 if (NILP (XCAR (tem))) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7315 continue; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7316 if (!size) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7317 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7318 newlist = Fcons (XCAR (tem), newlist); |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7319 n_fonts++; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7320 if (n_fonts >= maxnames) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7321 break; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7322 else |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7323 continue; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7324 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7325 if (!INTEGERP (XCDR (tem))) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7326 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7327 /* Since we don't yet know the size of the font, we must |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7328 load it and try GetTextMetrics. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7329 W32FontStruct thisinfo; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7330 LOGFONT lf; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7331 HDC hdc; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7332 HANDLE oldobj; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7333 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7334 if (!x_to_w32_font (XSTRING (XCAR (tem))->data, &lf)) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7335 continue; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7336 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7337 BLOCK_INPUT; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7338 thisinfo.bdf = NULL; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7339 thisinfo.hfont = CreateFontIndirect (&lf); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7340 if (thisinfo.hfont == NULL) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7341 continue; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7342 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7343 hdc = GetDC (dpyinfo->root_window); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7344 oldobj = SelectObject (hdc, thisinfo.hfont); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7345 if (GetTextMetrics (hdc, &thisinfo.tm)) |
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
39812
diff
changeset
|
7346 XSETCDR (tem, make_number (FONT_WIDTH (&thisinfo))); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7347 else |
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
39812
diff
changeset
|
7348 XSETCDR (tem, make_number (0)); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7349 SelectObject (hdc, oldobj); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7350 ReleaseDC (dpyinfo->root_window, hdc); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7351 DeleteObject(thisinfo.hfont); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7352 UNBLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7353 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7354 found_size = XINT (XCDR (tem)); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7355 if (found_size == size) |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7356 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7357 newlist = Fcons (XCAR (tem), newlist); |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7358 n_fonts++; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7359 if (n_fonts >= maxnames) |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7360 break; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7361 } |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7362 /* keep track of the closest matching size in case |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7363 no exact match is found. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7364 else if (found_size > 0) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7365 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7366 if (NILP (second_best)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7367 second_best = tem; |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7368 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7369 else if (found_size < size) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7370 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7371 if (XINT (XCDR (second_best)) > size |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7372 || XINT (XCDR (second_best)) < found_size) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7373 second_best = tem; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7374 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7375 else |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7376 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7377 if (XINT (XCDR (second_best)) > size |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7378 && XINT (XCDR (second_best)) > |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7379 found_size) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7380 second_best = tem; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7381 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7382 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7383 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7384 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7385 if (!NILP (newlist)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7386 break; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7387 else if (!NILP (second_best)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7388 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7389 newlist = Fcons (XCAR (second_best), Qnil); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7390 break; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7391 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7392 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7393 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7394 /* Include any bdf fonts. */ |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7395 if (n_fonts < maxnames) |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7396 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7397 Lisp_Object combined[2]; |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7398 combined[0] = w32_list_bdf_fonts (pattern, maxnames - n_fonts); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7399 combined[1] = newlist; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7400 newlist = Fnconc(2, combined); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7401 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7402 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7403 return newlist; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7404 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7405 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7406 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7407 /* Return a pointer to struct font_info of font FONT_IDX of frame F. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7408 struct font_info * |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7409 w32_get_font_info (f, font_idx) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7410 FRAME_PTR f; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7411 int font_idx; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7412 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7413 return (FRAME_W32_FONT_TABLE (f) + font_idx); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7414 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7415 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7416 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7417 struct font_info* |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7418 w32_query_font (struct frame *f, char *fontname) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7419 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7420 int i; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7421 struct font_info *pfi; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7422 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7423 pfi = FRAME_W32_FONT_TABLE (f); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7424 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7425 for (i = 0; i < one_w32_display_info.n_fonts ;i++, pfi++) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7426 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7427 if (strcmp(pfi->name, fontname) == 0) return pfi; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7428 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7429 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7430 return NULL; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7431 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7432 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7433 /* Find a CCL program for a font specified by FONTP, and set the member |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7434 `encoder' of the structure. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7435 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7436 void |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7437 w32_find_ccl_program (fontp) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7438 struct font_info *fontp; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7439 { |
25069
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7440 Lisp_Object list, elt; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7441 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7442 for (list = Vfont_ccl_encoder_alist; CONSP (list); list = XCDR (list)) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7443 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7444 elt = XCAR (list); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7445 if (CONSP (elt) |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7446 && STRINGP (XCAR (elt)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7447 && (fast_c_string_match_ignore_case (XCAR (elt), fontp->name) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7448 >= 0)) |
25069
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7449 break; |
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7450 } |
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7451 if (! NILP (list)) |
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7452 { |
25084
d89aa269255d
(w32_find_ccl_program): Add casting.
Kenichi Handa <handa@m17n.org>
parents:
25069
diff
changeset
|
7453 struct ccl_program *ccl |
d89aa269255d
(w32_find_ccl_program): Add casting.
Kenichi Handa <handa@m17n.org>
parents:
25069
diff
changeset
|
7454 = (struct ccl_program *) xmalloc (sizeof (struct ccl_program)); |
25069
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7455 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7456 if (setup_ccl_program (ccl, XCDR (elt)) < 0) |
25069
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7457 xfree (ccl); |
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7458 else |
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7459 fontp->font_encoder = ccl; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7460 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7461 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7462 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7463 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7464 /* Find BDF files in a specified directory. (use GCPRO when calling, |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7465 as this calls lisp to get a directory listing). */ |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7466 static Lisp_Object |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7467 w32_find_bdf_fonts_in_dir (Lisp_Object directory) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7468 { |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7469 Lisp_Object filelist, list = Qnil; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7470 char fontname[100]; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7471 |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7472 if (!STRINGP(directory)) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7473 return Qnil; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7474 |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7475 filelist = Fdirectory_files (directory, Qt, |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7476 build_string (".*\\.[bB][dD][fF]"), Qt); |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7477 |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7478 for ( ; CONSP(filelist); filelist = XCDR (filelist)) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7479 { |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7480 Lisp_Object filename = XCAR (filelist); |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7481 if (w32_BDF_to_x_font (XSTRING (filename)->data, fontname, 100)) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7482 store_in_alist (&list, build_string (fontname), filename); |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7483 } |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7484 return list; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7485 } |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7486 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7487 DEFUN ("w32-find-bdf-fonts", Fw32_find_bdf_fonts, Sw32_find_bdf_fonts, |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7488 1, 1, 0, |
41019 | 7489 doc: /* Return a list of BDF fonts in DIR. |
7490 The list is suitable for appending to w32-bdf-filename-alist. Fonts | |
7491 which do not contain an xlfd description will not be included in the | |
7492 list. DIR may be a list of directories. */) | |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7493 (directory) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7494 Lisp_Object directory; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7495 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7496 Lisp_Object list = Qnil; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7497 struct gcpro gcpro1, gcpro2; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7498 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7499 if (!CONSP (directory)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7500 return w32_find_bdf_fonts_in_dir (directory); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7501 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7502 for ( ; CONSP (directory); directory = XCDR (directory)) |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7503 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7504 Lisp_Object pair[2]; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7505 pair[0] = list; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7506 pair[1] = Qnil; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7507 GCPRO2 (directory, list); |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7508 pair[1] = w32_find_bdf_fonts_in_dir( XCAR (directory) ); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7509 list = Fnconc( 2, pair ); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7510 UNGCPRO; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7511 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7512 return list; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7513 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7514 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7515 |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
25646
diff
changeset
|
7516 DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7517 doc: /* Internal function called by `color-defined-p', which see. */) |
13434 | 7518 (color, frame) |
7519 Lisp_Object color, frame; | |
7520 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7521 XColor foo; |
13434 | 7522 FRAME_PTR f = check_x_frame (frame); |
7523 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
7524 CHECK_STRING (color); |
13434 | 7525 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7526 if (w32_defined_color (f, XSTRING (color)->data, &foo, 0)) |
13434 | 7527 return Qt; |
7528 else | |
7529 return Qnil; | |
7530 } | |
7531 | |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
25646
diff
changeset
|
7532 DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7533 doc: /* Internal function called by `color-values', which see. */) |
13434 | 7534 (color, frame) |
7535 Lisp_Object color, frame; | |
7536 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7537 XColor foo; |
13434 | 7538 FRAME_PTR f = check_x_frame (frame); |
7539 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
7540 CHECK_STRING (color); |
13434 | 7541 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7542 if (w32_defined_color (f, XSTRING (color)->data, &foo, 0)) |
13434 | 7543 { |
7544 Lisp_Object rgb[3]; | |
7545 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7546 rgb[0] = make_number ((GetRValue (foo.pixel) << 8) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7547 | GetRValue (foo.pixel)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7548 rgb[1] = make_number ((GetGValue (foo.pixel) << 8) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7549 | GetGValue (foo.pixel)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7550 rgb[2] = make_number ((GetBValue (foo.pixel) << 8) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7551 | GetBValue (foo.pixel)); |
13434 | 7552 return Flist (3, rgb); |
7553 } | |
7554 else | |
7555 return Qnil; | |
7556 } | |
7557 | |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
25646
diff
changeset
|
7558 DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7559 doc: /* Internal function called by `display-color-p', which see. */) |
13434 | 7560 (display) |
7561 Lisp_Object display; | |
7562 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7563 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7564 |
7565 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 2) | |
7566 return Qnil; | |
7567 | |
7568 return Qt; | |
7569 } | |
7570 | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7571 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7572 Sx_display_grayscale_p, 0, 1, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7573 doc: /* Return t if the X display supports shades of gray. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7574 Note that color displays do support shades of gray. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7575 The optional argument DISPLAY specifies which display to ask about. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7576 DISPLAY should be either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7577 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7578 (display) |
7579 Lisp_Object display; | |
7580 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7581 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7582 |
7583 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 1) | |
7584 return Qnil; | |
7585 | |
7586 return Qt; | |
7587 } | |
7588 | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7589 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7590 Sx_display_pixel_width, 0, 1, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7591 doc: /* Returns the width in pixels of DISPLAY. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7592 The optional argument DISPLAY specifies which display to ask about. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7593 DISPLAY should be either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7594 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7595 (display) |
7596 Lisp_Object display; | |
7597 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7598 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7599 |
7600 return make_number (dpyinfo->width); | |
7601 } | |
7602 | |
7603 DEFUN ("x-display-pixel-height", Fx_display_pixel_height, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7604 Sx_display_pixel_height, 0, 1, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7605 doc: /* Returns the height in pixels of DISPLAY. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7606 The optional argument DISPLAY specifies which display to ask about. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7607 DISPLAY should be either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7608 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7609 (display) |
7610 Lisp_Object display; | |
7611 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7612 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7613 |
7614 return make_number (dpyinfo->height); | |
7615 } | |
7616 | |
7617 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7618 0, 1, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7619 doc: /* Returns the number of bitplanes of DISPLAY. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7620 The optional argument DISPLAY specifies which display to ask about. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7621 DISPLAY should be either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7622 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7623 (display) |
7624 Lisp_Object display; | |
7625 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7626 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7627 |
7628 return make_number (dpyinfo->n_planes * dpyinfo->n_cbits); | |
7629 } | |
7630 | |
7631 DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7632 0, 1, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7633 doc: /* Returns the number of color cells of DISPLAY. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7634 The optional argument DISPLAY specifies which display to ask about. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7635 DISPLAY should be either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7636 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7637 (display) |
7638 Lisp_Object display; | |
7639 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7640 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7641 HDC hdc; |
7642 int cap; | |
7643 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7644 hdc = GetDC (dpyinfo->root_window); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7645 if (dpyinfo->has_palette) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7646 cap = GetDeviceCaps (hdc,SIZEPALETTE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7647 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7648 cap = GetDeviceCaps (hdc,NUMCOLORS); |
34998
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7649 |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7650 if (cap < 0) |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7651 cap = 1 << (dpyinfo->n_planes * dpyinfo->n_cbits); |
13434 | 7652 |
7653 ReleaseDC (dpyinfo->root_window, hdc); | |
7654 | |
7655 return make_number (cap); | |
7656 } | |
7657 | |
7658 DEFUN ("x-server-max-request-size", Fx_server_max_request_size, | |
7659 Sx_server_max_request_size, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7660 0, 1, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7661 doc: /* Returns the maximum request size of the server of DISPLAY. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7662 The optional argument DISPLAY specifies which display to ask about. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7663 DISPLAY should be either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7664 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7665 (display) |
7666 Lisp_Object display; | |
7667 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7668 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7669 |
7670 return make_number (1); | |
7671 } | |
7672 | |
7673 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7674 doc: /* Returns the vendor ID string of the W32 system (Microsoft). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7675 The optional argument DISPLAY specifies which display to ask about. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7676 DISPLAY should be either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7677 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7678 (display) |
7679 Lisp_Object display; | |
7680 { | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
7681 return build_string ("Microsoft Corp."); |
13434 | 7682 } |
7683 | |
7684 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7685 doc: /* Returns the version numbers of the server of DISPLAY. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7686 The value is a list of three integers: the major and minor |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7687 version numbers, and the vendor-specific release |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7688 number. See also the function `x-server-vendor'. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7689 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7690 The optional argument DISPLAY specifies which display to ask about. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7691 DISPLAY should be either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7692 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7693 (display) |
7694 Lisp_Object display; | |
7695 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7696 return Fcons (make_number (w32_major_version), |
33216
2eb7d429a997
(Fx_server_version): Include w32_build_number in the
Andrew Innes <andrewi@gnu.org>
parents:
32977
diff
changeset
|
7697 Fcons (make_number (w32_minor_version), |
2eb7d429a997
(Fx_server_version): Include w32_build_number in the
Andrew Innes <andrewi@gnu.org>
parents:
32977
diff
changeset
|
7698 Fcons (make_number (w32_build_number), Qnil))); |
13434 | 7699 } |
7700 | |
7701 DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7702 doc: /* Returns the number of screens on the server of DISPLAY. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7703 The optional argument DISPLAY specifies which display to ask about. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7704 DISPLAY should be either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7705 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7706 (display) |
7707 Lisp_Object display; | |
7708 { | |
7709 return make_number (1); | |
7710 } | |
7711 | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7712 DEFUN ("x-display-mm-height", Fx_display_mm_height, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7713 Sx_display_mm_height, 0, 1, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7714 doc: /* Returns the height in millimeters of DISPLAY. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7715 The optional argument DISPLAY specifies which display to ask about. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7716 DISPLAY should be either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7717 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7718 (display) |
7719 Lisp_Object display; | |
7720 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7721 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7722 HDC hdc; |
7723 int cap; | |
7724 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7725 hdc = GetDC (dpyinfo->root_window); |
14353 | 7726 |
13434 | 7727 cap = GetDeviceCaps (hdc, VERTSIZE); |
14353 | 7728 |
13434 | 7729 ReleaseDC (dpyinfo->root_window, hdc); |
7730 | |
7731 return make_number (cap); | |
7732 } | |
7733 | |
7734 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7735 doc: /* Returns the width in millimeters of DISPLAY. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7736 The optional argument DISPLAY specifies which display to ask about. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7737 DISPLAY should be either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7738 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7739 (display) |
7740 Lisp_Object display; | |
7741 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7742 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7743 |
7744 HDC hdc; | |
7745 int cap; | |
7746 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7747 hdc = GetDC (dpyinfo->root_window); |
14353 | 7748 |
13434 | 7749 cap = GetDeviceCaps (hdc, HORZSIZE); |
14353 | 7750 |
13434 | 7751 ReleaseDC (dpyinfo->root_window, hdc); |
7752 | |
7753 return make_number (cap); | |
7754 } | |
7755 | |
7756 DEFUN ("x-display-backing-store", Fx_display_backing_store, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7757 Sx_display_backing_store, 0, 1, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7758 doc: /* Returns an indication of whether DISPLAY does backing store. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7759 The value may be `always', `when-mapped', or `not-useful'. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7760 The optional argument DISPLAY specifies which display to ask about. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7761 DISPLAY should be either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7762 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7763 (display) |
7764 Lisp_Object display; | |
7765 { | |
7766 return intern ("not-useful"); | |
7767 } | |
7768 | |
7769 DEFUN ("x-display-visual-class", Fx_display_visual_class, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7770 Sx_display_visual_class, 0, 1, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7771 doc: /* Returns the visual class of DISPLAY. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7772 The value is one of the symbols `static-gray', `gray-scale', |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7773 `static-color', `pseudo-color', `true-color', or `direct-color'. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7774 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7775 The optional argument DISPLAY specifies which display to ask about. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7776 DISPLAY should be either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7777 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7778 (display) |
7779 Lisp_Object display; | |
7780 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7781 struct w32_display_info *dpyinfo = check_x_display_info (display); |
34998
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7782 Lisp_Object result = Qnil; |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7783 |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7784 if (dpyinfo->has_palette) |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7785 result = intern ("pseudo-color"); |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7786 else if (dpyinfo->n_planes * dpyinfo->n_cbits == 1) |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7787 result = intern ("static-grey"); |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7788 else if (dpyinfo->n_planes * dpyinfo->n_cbits == 4) |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7789 result = intern ("static-color"); |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7790 else if (dpyinfo->n_planes * dpyinfo->n_cbits > 8) |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7791 result = intern ("true-color"); |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7792 |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7793 return result; |
13434 | 7794 } |
7795 | |
7796 DEFUN ("x-display-save-under", Fx_display_save_under, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7797 Sx_display_save_under, 0, 1, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7798 doc: /* Returns t if DISPLAY supports the save-under feature. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7799 The optional argument DISPLAY specifies which display to ask about. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7800 DISPLAY should be either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7801 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7802 (display) |
7803 Lisp_Object display; | |
7804 { | |
7805 return Qnil; | |
7806 } | |
7807 | |
7808 int | |
7809 x_pixel_width (f) | |
7810 register struct frame *f; | |
7811 { | |
7812 return PIXEL_WIDTH (f); | |
7813 } | |
7814 | |
7815 int | |
7816 x_pixel_height (f) | |
7817 register struct frame *f; | |
7818 { | |
7819 return PIXEL_HEIGHT (f); | |
7820 } | |
7821 | |
7822 int | |
7823 x_char_width (f) | |
7824 register struct frame *f; | |
7825 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7826 return FONT_WIDTH (f->output_data.w32->font); |
13434 | 7827 } |
7828 | |
7829 int | |
7830 x_char_height (f) | |
7831 register struct frame *f; | |
7832 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7833 return f->output_data.w32->line_height; |
13434 | 7834 } |
7835 | |
7836 int | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7837 x_screen_planes (f) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7838 register struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7839 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7840 return FRAME_W32_DISPLAY_INFO (f)->n_planes; |
13434 | 7841 } |
7842 | |
7843 /* Return the display structure for the display named NAME. | |
7844 Open a new connection if necessary. */ | |
7845 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7846 struct w32_display_info * |
13434 | 7847 x_display_info_for_name (name) |
7848 Lisp_Object name; | |
7849 { | |
7850 Lisp_Object names; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7851 struct w32_display_info *dpyinfo; |
13434 | 7852 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
7853 CHECK_STRING (name); |
13434 | 7854 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7855 for (dpyinfo = &one_w32_display_info, names = w32_display_name_list; |
13434 | 7856 dpyinfo; |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7857 dpyinfo = dpyinfo->next, names = XCDR (names)) |
13434 | 7858 { |
7859 Lisp_Object tem; | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7860 tem = Fstring_equal (XCAR (XCAR (names)), name); |
13434 | 7861 if (!NILP (tem)) |
7862 return dpyinfo; | |
7863 } | |
7864 | |
7865 /* Use this general default value to start with. */ | |
7866 Vx_resource_name = Vinvocation_name; | |
7867 | |
7868 validate_x_resource_name (); | |
7869 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7870 dpyinfo = w32_term_init (name, (unsigned char *)0, |
13434 | 7871 (char *) XSTRING (Vx_resource_name)->data); |
7872 | |
7873 if (dpyinfo == 0) | |
7874 error ("Cannot connect to server %s", XSTRING (name)->data); | |
7875 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
7876 w32_in_use = 1; |
13434 | 7877 XSETFASTINT (Vwindow_system_version, 3); |
7878 | |
7879 return dpyinfo; | |
7880 } | |
7881 | |
7882 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7883 1, 3, 0, doc: /* Open a connection to a server. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7884 DISPLAY is the name of the display to connect to. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7885 Optional second arg XRM-STRING is a string of resources in xrdb format. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7886 If the optional third arg MUST-SUCCEED is non-nil, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7887 terminate Emacs if we can't open the connection. */) |
13434 | 7888 (display, xrm_string, must_succeed) |
7889 Lisp_Object display, xrm_string, must_succeed; | |
7890 { | |
7891 unsigned char *xrm_option; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7892 struct w32_display_info *dpyinfo; |
13434 | 7893 |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7894 /* If initialization has already been done, return now to avoid |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7895 overwriting critical parts of one_w32_display_info. */ |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7896 if (w32_in_use) |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7897 return Qnil; |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7898 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
7899 CHECK_STRING (display); |
13434 | 7900 if (! NILP (xrm_string)) |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
7901 CHECK_STRING (xrm_string); |
13434 | 7902 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
7903 if (! EQ (Vwindow_system, intern ("w32"))) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
7904 error ("Not using Microsoft Windows"); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
7905 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7906 /* 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
|
7907 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
|
7908 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7909 Lisp_Object color_file; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7910 struct gcpro gcpro1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7911 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7912 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
|
7913 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7914 GCPRO1 (color_file); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7915 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7916 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
|
7917 color_file = |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7918 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
|
7919 Fsymbol_value (intern ("data-directory"))); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7920 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7921 Vw32_color_map = Fw32_load_color_file (color_file); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7922 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7923 UNGCPRO; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7924 } |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7925 if (NILP (Vw32_color_map)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7926 Vw32_color_map = Fw32_default_color_map (); |
13434 | 7927 |
7928 if (! NILP (xrm_string)) | |
7929 xrm_option = (unsigned char *) XSTRING (xrm_string)->data; | |
7930 else | |
7931 xrm_option = (unsigned char *) 0; | |
7932 | |
7933 /* 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
|
7934 /* 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
|
7935 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7936 char basename[ MAX_PATH ], *str; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7937 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7938 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
|
7939 str = strrchr (basename, '.'); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7940 if (str) *str = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7941 Vinvocation_name = build_string (basename); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7942 } |
13434 | 7943 Vx_resource_name = Vinvocation_name; |
7944 | |
7945 validate_x_resource_name (); | |
7946 | |
7947 /* This is what opens the connection and sets x_current_display. | |
7948 This also initializes many symbols, such as those used for input. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7949 dpyinfo = w32_term_init (display, xrm_option, |
13434 | 7950 (char *) XSTRING (Vx_resource_name)->data); |
7951 | |
7952 if (dpyinfo == 0) | |
7953 { | |
7954 if (!NILP (must_succeed)) | |
14353 | 7955 fatal ("Cannot connect to server %s.\n", |
7956 XSTRING (display)->data); | |
13434 | 7957 else |
7958 error ("Cannot connect to server %s", XSTRING (display)->data); | |
7959 } | |
7960 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
7961 w32_in_use = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
7962 |
13434 | 7963 XSETFASTINT (Vwindow_system_version, 3); |
7964 return Qnil; | |
7965 } | |
7966 | |
7967 DEFUN ("x-close-connection", Fx_close_connection, | |
7968 Sx_close_connection, 1, 1, 0, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7969 doc: /* Close the connection to DISPLAY's server. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7970 For DISPLAY, specify either a frame or a display name (a string). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7971 If DISPLAY is nil, that stands for the selected frame's display. */) |
13434 | 7972 (display) |
7973 Lisp_Object display; | |
7974 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7975 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7976 int i; |
7977 | |
7978 if (dpyinfo->reference_count > 0) | |
7979 error ("Display still has frames on it"); | |
7980 | |
7981 BLOCK_INPUT; | |
7982 /* Free the fonts in the font table. */ | |
7983 for (i = 0; i < dpyinfo->n_fonts; i++) | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7984 if (dpyinfo->font_table[i].name) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7985 { |
28272
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
7986 if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name) |
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
7987 xfree (dpyinfo->font_table[i].full_name); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7988 xfree (dpyinfo->font_table[i].name); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7989 w32_unload_font (dpyinfo, dpyinfo->font_table[i].font); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7990 } |
13434 | 7991 x_destroy_all_bitmaps (dpyinfo); |
7992 | |
7993 x_delete_display (dpyinfo); | |
7994 UNBLOCK_INPUT; | |
7995 | |
7996 return Qnil; | |
7997 } | |
7998 | |
7999 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
8000 doc: /* Return the list of display names that Emacs has connections to. */) |
13434 | 8001 () |
8002 { | |
8003 Lisp_Object tail, result; | |
8004 | |
8005 result = Qnil; | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
8006 for (tail = w32_display_name_list; ! NILP (tail); tail = XCDR (tail)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
8007 result = Fcons (XCAR (XCAR (tail)), result); |
13434 | 8008 |
8009 return result; | |
8010 } | |
8011 | |
8012 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, | |
41008 | 8013 doc: /* This is a noop on W32 systems. */) |
8014 (on, display) | |
8015 Lisp_Object display, on; | |
13434 | 8016 { |
8017 return Qnil; | |
8018 } | |
8019 | |
8020 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8021 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8022 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8023 Image types |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8024 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8025 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8026 /* Value is the number of elements of vector VECTOR. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8027 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8028 #define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8029 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8030 /* List of supported image types. Use define_image_type to add new |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8031 types. Use lookup_image_type to find a type for a given symbol. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8032 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8033 static struct image_type *image_types; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8034 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8035 /* The symbol `image' which is the car of the lists used to represent |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8036 images in Lisp. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8037 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8038 extern Lisp_Object Qimage; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8039 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8040 /* The symbol `xbm' which is used as the type symbol for XBM images. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8041 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8042 Lisp_Object Qxbm; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8043 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8044 /* Keywords. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8045 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8046 extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8047 extern Lisp_Object QCdata; |
28272
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
8048 Lisp_Object QCtype, QCascent, QCmargin, QCrelief; |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
8049 Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8050 Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8051 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8052 /* Other symbols. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8053 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8054 Lisp_Object Qlaplace, Qemboss, Qedge_detection, Qheuristic; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8055 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8056 /* Time in seconds after which images should be removed from the cache |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8057 if not displayed. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8058 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8059 Lisp_Object Vimage_cache_eviction_delay; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8060 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8061 /* Function prototypes. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8062 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8063 static void define_image_type P_ ((struct image_type *type)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8064 static struct image_type *lookup_image_type P_ ((Lisp_Object symbol)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8065 static void image_error P_ ((char *format, Lisp_Object, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8066 static void x_laplace P_ ((struct frame *, struct image *)); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8067 static void x_emboss P_ ((struct frame *, struct image *)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8068 static int x_build_heuristic_mask P_ ((struct frame *, struct image *, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8069 Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8070 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8071 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8072 /* Define a new image type from TYPE. This adds a copy of TYPE to |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8073 image_types and adds the symbol *TYPE->type to Vimage_types. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8074 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8075 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8076 define_image_type (type) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8077 struct image_type *type; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8078 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8079 /* Make a copy of TYPE to avoid a bus error in a dumped Emacs. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8080 The initialized data segment is read-only. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8081 struct image_type *p = (struct image_type *) xmalloc (sizeof *p); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8082 bcopy (type, p, sizeof *p); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8083 p->next = image_types; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8084 image_types = p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8085 Vimage_types = Fcons (*p->type, Vimage_types); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8086 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8087 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8088 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8089 /* Look up image type SYMBOL, and return a pointer to its image_type |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8090 structure. Value is null if SYMBOL is not a known image type. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8091 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8092 static INLINE struct image_type * |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8093 lookup_image_type (symbol) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8094 Lisp_Object symbol; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8095 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8096 struct image_type *type; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8097 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8098 for (type = image_types; type; type = type->next) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8099 if (EQ (symbol, *type->type)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8100 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8101 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8102 return type; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8103 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8104 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8105 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8106 /* Value is non-zero if OBJECT is a valid Lisp image specification. A |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8107 valid image specification is a list whose car is the symbol |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8108 `image', and whose rest is a property list. The property list must |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8109 contain a value for key `:type'. That value must be the name of a |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8110 supported image type. The rest of the property list depends on the |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8111 image type. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8112 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8113 int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8114 valid_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8115 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8116 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8117 int valid_p = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8118 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8119 if (CONSP (object) && EQ (XCAR (object), Qimage)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8120 { |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8121 Lisp_Object tem; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8122 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8123 for (tem = XCDR (object); CONSP (tem); tem = XCDR (tem)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8124 if (EQ (XCAR (tem), QCtype)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8125 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8126 tem = XCDR (tem); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8127 if (CONSP (tem) && SYMBOLP (XCAR (tem))) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8128 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8129 struct image_type *type; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8130 type = lookup_image_type (XCAR (tem)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8131 if (type) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8132 valid_p = type->valid_p (object); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8133 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8134 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8135 break; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8136 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8137 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8138 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8139 return valid_p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8140 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8141 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8142 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8143 /* Log error message with format string FORMAT and argument ARG. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8144 Signaling an error, e.g. when an image cannot be loaded, is not a |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8145 good idea because this would interrupt redisplay, and the error |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8146 message display would lead to another redisplay. This function |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8147 therefore simply displays a message. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8148 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8149 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8150 image_error (format, arg1, arg2) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8151 char *format; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8152 Lisp_Object arg1, arg2; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8153 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8154 add_to_log (format, arg1, arg2); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8155 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8156 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8157 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8158 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8159 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8160 Image specifications |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8161 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8162 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8163 enum image_value_type |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8164 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8165 IMAGE_DONT_CHECK_VALUE_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8166 IMAGE_STRING_VALUE, |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8167 IMAGE_STRING_OR_NIL_VALUE, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8168 IMAGE_SYMBOL_VALUE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8169 IMAGE_POSITIVE_INTEGER_VALUE, |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8170 IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8171 IMAGE_NON_NEGATIVE_INTEGER_VALUE, |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8172 IMAGE_ASCENT_VALUE, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8173 IMAGE_INTEGER_VALUE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8174 IMAGE_FUNCTION_VALUE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8175 IMAGE_NUMBER_VALUE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8176 IMAGE_BOOL_VALUE |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8177 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8178 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8179 /* Structure used when parsing image specifications. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8180 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8181 struct image_keyword |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8182 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8183 /* Name of keyword. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8184 char *name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8185 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8186 /* The type of value allowed. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8187 enum image_value_type type; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8188 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8189 /* Non-zero means key must be present. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8190 int mandatory_p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8191 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8192 /* Used to recognize duplicate keywords in a property list. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8193 int count; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8194 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8195 /* The value that was found. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8196 Lisp_Object value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8197 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8198 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8199 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8200 static int parse_image_spec P_ ((Lisp_Object, struct image_keyword *, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8201 int, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8202 static Lisp_Object image_spec_value P_ ((Lisp_Object, Lisp_Object, int *)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8203 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8204 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8205 /* Parse image spec SPEC according to KEYWORDS. A valid image spec |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8206 has the format (image KEYWORD VALUE ...). One of the keyword/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8207 value pairs must be `:type TYPE'. KEYWORDS is a vector of |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8208 image_keywords structures of size NKEYWORDS describing other |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8209 allowed keyword/value pairs. Value is non-zero if SPEC is valid. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8210 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8211 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8212 parse_image_spec (spec, keywords, nkeywords, type) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8213 Lisp_Object spec; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8214 struct image_keyword *keywords; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8215 int nkeywords; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8216 Lisp_Object type; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8217 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8218 int i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8219 Lisp_Object plist; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8220 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8221 if (!CONSP (spec) || !EQ (XCAR (spec), Qimage)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8222 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8223 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8224 plist = XCDR (spec); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8225 while (CONSP (plist)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8226 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8227 Lisp_Object key, value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8228 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8229 /* First element of a pair must be a symbol. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8230 key = XCAR (plist); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8231 plist = XCDR (plist); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8232 if (!SYMBOLP (key)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8233 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8234 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8235 /* There must follow a value. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8236 if (!CONSP (plist)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8237 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8238 value = XCAR (plist); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8239 plist = XCDR (plist); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8240 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8241 /* Find key in KEYWORDS. Error if not found. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8242 for (i = 0; i < nkeywords; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8243 if (strcmp (keywords[i].name, XSYMBOL (key)->name->data) == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8244 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8245 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8246 if (i == nkeywords) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8247 continue; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8248 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8249 /* Record that we recognized the keyword. If a keywords |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8250 was found more than once, it's an error. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8251 keywords[i].value = value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8252 ++keywords[i].count; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8253 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8254 if (keywords[i].count > 1) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8255 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8256 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8257 /* Check type of value against allowed type. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8258 switch (keywords[i].type) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8259 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8260 case IMAGE_STRING_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8261 if (!STRINGP (value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8262 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8263 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8264 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8265 case IMAGE_STRING_OR_NIL_VALUE: |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8266 if (!STRINGP (value) && !NILP (value)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8267 return 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8268 break; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8269 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8270 case IMAGE_SYMBOL_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8271 if (!SYMBOLP (value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8272 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8273 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8274 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8275 case IMAGE_POSITIVE_INTEGER_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8276 if (!INTEGERP (value) || XINT (value) <= 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8277 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8278 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8279 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8280 case IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR: |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8281 if (INTEGERP (value) && XINT (value) >= 0) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8282 break; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8283 if (CONSP (value) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8284 && INTEGERP (XCAR (value)) && INTEGERP (XCDR (value)) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8285 && XINT (XCAR (value)) >= 0 && XINT (XCDR (value)) >= 0) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8286 break; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8287 return 0; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8288 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8289 case IMAGE_ASCENT_VALUE: |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8290 if (SYMBOLP (value) && EQ (value, Qcenter)) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8291 break; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8292 else if (INTEGERP (value) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8293 && XINT (value) >= 0 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8294 && XINT (value) <= 100) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8295 break; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8296 return 0; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8297 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8298 case IMAGE_NON_NEGATIVE_INTEGER_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8299 if (!INTEGERP (value) || XINT (value) < 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8300 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8301 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8302 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8303 case IMAGE_DONT_CHECK_VALUE_TYPE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8304 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8305 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8306 case IMAGE_FUNCTION_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8307 value = indirect_function (value); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8308 if (SUBRP (value) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8309 || COMPILEDP (value) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8310 || (CONSP (value) && EQ (XCAR (value), Qlambda))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8311 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8312 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8313 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8314 case IMAGE_NUMBER_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8315 if (!INTEGERP (value) && !FLOATP (value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8316 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8317 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8318 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8319 case IMAGE_INTEGER_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8320 if (!INTEGERP (value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8321 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8322 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8323 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8324 case IMAGE_BOOL_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8325 if (!NILP (value) && !EQ (value, Qt)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8326 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8327 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8328 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8329 default: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8330 abort (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8331 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8332 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8333 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8334 if (EQ (key, QCtype) && !EQ (type, value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8335 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8336 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8337 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8338 /* Check that all mandatory fields are present. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8339 for (i = 0; i < nkeywords; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8340 if (keywords[i].mandatory_p && keywords[i].count == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8341 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8342 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8343 return NILP (plist); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8344 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8345 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8346 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8347 /* Return the value of KEY in image specification SPEC. Value is nil |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8348 if KEY is not present in SPEC. if FOUND is not null, set *FOUND |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8349 to 1 if KEY was found in SPEC, set it to 0 otherwise. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8350 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8351 static Lisp_Object |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8352 image_spec_value (spec, key, found) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8353 Lisp_Object spec, key; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8354 int *found; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8355 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8356 Lisp_Object tail; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8357 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8358 xassert (valid_image_p (spec)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8359 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8360 for (tail = XCDR (spec); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8361 CONSP (tail) && CONSP (XCDR (tail)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8362 tail = XCDR (XCDR (tail))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8363 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8364 if (EQ (XCAR (tail), key)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8365 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8366 if (found) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8367 *found = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8368 return XCAR (XCDR (tail)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8369 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8370 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8371 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8372 if (found) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8373 *found = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8374 return Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8375 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8376 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8377 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8378 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8379 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8380 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8381 Image type independent image structures |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8382 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8383 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8384 static struct image *make_image P_ ((Lisp_Object spec, unsigned hash)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8385 static void free_image P_ ((struct frame *f, struct image *img)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8386 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8387 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8388 /* Allocate and return a new image structure for image specification |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8389 SPEC. SPEC has a hash value of HASH. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8390 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8391 static struct image * |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8392 make_image (spec, hash) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8393 Lisp_Object spec; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8394 unsigned hash; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8395 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8396 struct image *img = (struct image *) xmalloc (sizeof *img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8397 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8398 xassert (valid_image_p (spec)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8399 bzero (img, sizeof *img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8400 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8401 xassert (img->type != NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8402 img->spec = spec; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8403 img->data.lisp_val = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8404 img->ascent = DEFAULT_IMAGE_ASCENT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8405 img->hash = hash; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8406 return img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8407 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8408 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8409 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8410 /* Free image IMG which was used on frame F, including its resources. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8411 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8412 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8413 free_image (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8414 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8415 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8416 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8417 if (img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8418 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8419 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8420 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8421 /* Remove IMG from the hash table of its cache. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8422 if (img->prev) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8423 img->prev->next = img->next; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8424 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8425 c->buckets[img->hash % IMAGE_CACHE_BUCKETS_SIZE] = img->next; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8426 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8427 if (img->next) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8428 img->next->prev = img->prev; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8429 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8430 c->images[img->id] = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8431 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8432 /* Free resources, then free IMG. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8433 img->type->free (f, img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8434 xfree (img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8435 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8436 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8437 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8438 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8439 /* Prepare image IMG for display on frame F. Must be called before |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8440 drawing an image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8441 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8442 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8443 prepare_image_for_display (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8444 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8445 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8446 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8447 EMACS_TIME t; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8448 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8449 /* We're about to display IMG, so set its timestamp to `now'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8450 EMACS_GET_TIME (t); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8451 img->timestamp = EMACS_SECS (t); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8452 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8453 /* If IMG doesn't have a pixmap yet, load it now, using the image |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8454 type dependent loader function. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8455 if (img->pixmap == 0 && !img->load_failed_p) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8456 img->load_failed_p = img->type->load (f, img) == 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8457 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8458 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8459 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8460 /* Value is the number of pixels for the ascent of image IMG when |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8461 drawn in face FACE. */ |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8462 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8463 int |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8464 image_ascent (img, face) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8465 struct image *img; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8466 struct face *face; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8467 { |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8468 int height = img->height + img->vmargin; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8469 int ascent; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8470 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8471 if (img->ascent == CENTERED_IMAGE_ASCENT) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8472 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8473 if (face->font) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8474 ascent = height / 2 - (FONT_DESCENT(face->font) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8475 - FONT_BASE(face->font)) / 2; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8476 else |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8477 ascent = height / 2; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8478 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8479 else |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8480 ascent = height * img->ascent / 100.0; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8481 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8482 return ascent; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8483 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8484 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8485 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8486 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8487 /* Image background colors. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8488 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8489 static unsigned long |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8490 four_corners_best (ximg, width, height) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8491 XImage *ximg; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8492 unsigned long width, height; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8493 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8494 #if 0 /* TODO: Image support. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8495 unsigned long corners[4], best; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8496 int i, best_count; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8497 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8498 /* Get the colors at the corners of ximg. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8499 corners[0] = XGetPixel (ximg, 0, 0); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8500 corners[1] = XGetPixel (ximg, width - 1, 0); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8501 corners[2] = XGetPixel (ximg, width - 1, height - 1); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8502 corners[3] = XGetPixel (ximg, 0, height - 1); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8503 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8504 /* Choose the most frequently found color as background. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8505 for (i = best_count = 0; i < 4; ++i) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8506 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8507 int j, n; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8508 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8509 for (j = n = 0; j < 4; ++j) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8510 if (corners[i] == corners[j]) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8511 ++n; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8512 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8513 if (n > best_count) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8514 best = corners[i], best_count = n; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8515 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8516 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8517 return best; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8518 #else |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8519 return 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8520 #endif |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8521 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8522 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8523 /* Return the `background' field of IMG. If IMG doesn't have one yet, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8524 it is guessed heuristically. If non-zero, XIMG is an existing XImage |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8525 object to use for the heuristic. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8526 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8527 unsigned long |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8528 image_background (img, f, ximg) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8529 struct image *img; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8530 struct frame *f; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8531 XImage *ximg; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8532 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8533 if (! img->background_valid) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8534 /* IMG doesn't have a background yet, try to guess a reasonable value. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8535 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8536 #if 0 /* TODO: Image support. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8537 int free_ximg = !ximg; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8538 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8539 if (! ximg) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8540 ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8541 0, 0, img->width, img->height, ~0, ZPixmap); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8542 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8543 img->background = four_corners_best (ximg, img->width, img->height); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8544 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8545 if (free_ximg) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8546 XDestroyImage (ximg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8547 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8548 img->background_valid = 1; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8549 #endif |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8550 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8551 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8552 return img->background; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8553 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8554 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8555 /* Return the `background_transparent' field of IMG. If IMG doesn't |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8556 have one yet, it is guessed heuristically. If non-zero, MASK is an |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8557 existing XImage object to use for the heuristic. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8558 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8559 int |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8560 image_background_transparent (img, f, mask) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8561 struct image *img; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8562 struct frame *f; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8563 XImage *mask; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8564 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8565 if (! img->background_transparent_valid) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8566 /* IMG doesn't have a background yet, try to guess a reasonable value. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8567 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8568 #if 0 /* TODO: Image support. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8569 if (img->mask) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8570 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8571 int free_mask = !mask; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8572 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8573 if (! mask) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8574 mask = XGetImage (FRAME_X_DISPLAY (f), img->mask, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8575 0, 0, img->width, img->height, ~0, ZPixmap); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8576 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8577 img->background_transparent |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8578 = !four_corners_best (mask, img->width, img->height); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8579 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8580 if (free_mask) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8581 XDestroyImage (mask); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8582 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8583 else |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8584 #endif |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8585 img->background_transparent = 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8586 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8587 img->background_transparent_valid = 1; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8588 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8589 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8590 return img->background_transparent; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8591 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8592 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8593 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8594 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8595 Helper functions for X image types |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8596 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8597 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8598 static void x_clear_image_1 P_ ((struct frame *, struct image *, int, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8599 int, int)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8600 static void x_clear_image P_ ((struct frame *f, struct image *img)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8601 static unsigned long x_alloc_image_color P_ ((struct frame *f, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8602 struct image *img, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8603 Lisp_Object color_name, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8604 unsigned long dflt)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8605 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8606 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8607 /* Clear X resources of image IMG on frame F. PIXMAP_P non-zero means |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8608 free the pixmap if any. MASK_P non-zero means clear the mask |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8609 pixmap if any. COLORS_P non-zero means free colors allocated for |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8610 the image, if any. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8611 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8612 static void |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8613 x_clear_image_1 (f, img, pixmap_p, mask_p, colors_p) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8614 struct frame *f; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8615 struct image *img; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8616 int pixmap_p, mask_p, colors_p; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8617 { |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
8618 #if 0 /* TODO: W32 image support */ |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8619 if (pixmap_p && img->pixmap) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8620 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8621 XFreePixmap (FRAME_X_DISPLAY (f), img->pixmap); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8622 img->pixmap = None; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8623 img->background_valid = 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8624 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8625 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8626 if (mask_p && img->mask) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8627 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8628 XFreePixmap (FRAME_X_DISPLAY (f), img->mask); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8629 img->mask = None; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8630 img->background_transparent_valid = 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8631 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8632 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8633 if (colors_p && img->ncolors) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8634 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8635 x_free_colors (f, img->colors, img->ncolors); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8636 xfree (img->colors); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8637 img->colors = NULL; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8638 img->ncolors = 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8639 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8640 #endif |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8641 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8642 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8643 /* Free X resources of image IMG which is used on frame F. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8644 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8645 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8646 x_clear_image (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8647 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8648 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8649 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
8650 #if 0 /* TODO: W32 image support */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8651 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8652 if (img->pixmap) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8653 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8654 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8655 XFreePixmap (NULL, img->pixmap); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8656 img->pixmap = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8657 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8658 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8659 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8660 if (img->ncolors) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8661 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8662 int class = FRAME_W32_DISPLAY_INFO (f)->visual->class; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8663 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8664 /* If display has an immutable color map, freeing colors is not |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8665 necessary and some servers don't allow it. So don't do it. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8666 if (class != StaticColor |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8667 && class != StaticGray |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8668 && class != TrueColor) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8669 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8670 Colormap cmap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8671 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8672 cmap = DefaultColormapOfScreen (FRAME_W32_DISPLAY_INFO (f)->screen); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8673 XFreeColors (FRAME_W32_DISPLAY (f), cmap, img->colors, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8674 img->ncolors, 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8675 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8676 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8677 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8678 xfree (img->colors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8679 img->colors = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8680 img->ncolors = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8681 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8682 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8683 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8684 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8685 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8686 /* Allocate color COLOR_NAME for image IMG on frame F. If color |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8687 cannot be allocated, use DFLT. Add a newly allocated color to |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8688 IMG->colors, so that it can be freed again. Value is the pixel |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8689 color. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8690 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8691 static unsigned long |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8692 x_alloc_image_color (f, img, color_name, dflt) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8693 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8694 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8695 Lisp_Object color_name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8696 unsigned long dflt; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8697 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
8698 #if 0 /* TODO: allocing colors. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8699 XColor color; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8700 unsigned long result; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8701 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8702 xassert (STRINGP (color_name)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8703 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8704 if (w32_defined_color (f, XSTRING (color_name)->data, &color, 1)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8705 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8706 /* This isn't called frequently so we get away with simply |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8707 reallocating the color vector to the needed size, here. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8708 ++img->ncolors; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8709 img->colors = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8710 (unsigned long *) xrealloc (img->colors, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8711 img->ncolors * sizeof *img->colors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8712 img->colors[img->ncolors - 1] = color.pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8713 result = color.pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8714 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8715 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8716 result = dflt; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8717 return result; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8718 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8719 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8720 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8721 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8722 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8723 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8724 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8725 Image Cache |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8726 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8727 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8728 static void cache_image P_ ((struct frame *f, struct image *img)); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8729 static void postprocess_image P_ ((struct frame *, struct image *)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8730 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8731 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8732 /* Return a new, initialized image cache that is allocated from the |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8733 heap. Call free_image_cache to free an image cache. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8734 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8735 struct image_cache * |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8736 make_image_cache () |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8737 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8738 struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8739 int size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8740 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8741 bzero (c, sizeof *c); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8742 c->size = 50; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8743 c->images = (struct image **) xmalloc (c->size * sizeof *c->images); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8744 size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8745 c->buckets = (struct image **) xmalloc (size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8746 bzero (c->buckets, size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8747 return c; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8748 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8749 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8750 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8751 /* Free image cache of frame F. Be aware that X frames share images |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8752 caches. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8753 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8754 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8755 free_image_cache (f) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8756 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8757 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8758 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8759 if (c) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8760 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8761 int i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8762 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8763 /* Cache should not be referenced by any frame when freed. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8764 xassert (c->refcount == 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8765 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8766 for (i = 0; i < c->used; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8767 free_image (f, c->images[i]); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8768 xfree (c->images); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8769 xfree (c); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8770 xfree (c->buckets); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8771 FRAME_X_IMAGE_CACHE (f) = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8772 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8773 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8774 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8775 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8776 /* Clear image cache of frame F. FORCE_P non-zero means free all |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8777 images. FORCE_P zero means clear only images that haven't been |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8778 displayed for some time. Should be called from time to time to |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8779 reduce the number of loaded images. If image-eviction-seconds is |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8780 non-nil, this frees images in the cache which weren't displayed for |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8781 at least that many seconds. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8782 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8783 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8784 clear_image_cache (f, force_p) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8785 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8786 int force_p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8787 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8788 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8789 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8790 if (c && INTEGERP (Vimage_cache_eviction_delay)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8791 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8792 EMACS_TIME t; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8793 unsigned long old; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8794 int i, any_freed_p = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8795 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8796 EMACS_GET_TIME (t); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8797 old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8798 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8799 for (i = 0; i < c->used; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8800 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8801 struct image *img = c->images[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8802 if (img != NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8803 && (force_p |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8804 || (img->timestamp > old))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8805 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8806 free_image (f, img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8807 any_freed_p = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8808 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8809 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8810 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8811 /* We may be clearing the image cache because, for example, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8812 Emacs was iconified for a longer period of time. In that |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8813 case, current matrices may still contain references to |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8814 images freed above. So, clear these matrices. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8815 if (any_freed_p) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8816 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8817 clear_current_matrices (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8818 ++windows_or_buffers_changed; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8819 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8820 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8821 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8822 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8823 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8824 DEFUN ("clear-image-cache", Fclear_image_cache, Sclear_image_cache, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8825 0, 1, 0, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
8826 doc: /* Clear the image cache of FRAME. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
8827 FRAME nil or omitted means use the selected frame. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
8828 FRAME t means clear the image caches of all frames. */) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8829 (frame) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8830 Lisp_Object frame; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8831 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8832 if (EQ (frame, Qt)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8833 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8834 Lisp_Object tail; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8835 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8836 FOR_EACH_FRAME (tail, frame) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8837 if (FRAME_W32_P (XFRAME (frame))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8838 clear_image_cache (XFRAME (frame), 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8839 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8840 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8841 clear_image_cache (check_x_frame (frame), 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8842 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8843 return Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8844 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8845 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8846 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8847 /* Compute masks and transform image IMG on frame F, as specified |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8848 by the image's specification, */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8849 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8850 static void |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8851 postprocess_image (f, img) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8852 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8853 struct image *img; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8854 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8855 #if 0 /* TODO: image support. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8856 /* Manipulation of the image's mask. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8857 if (img->pixmap) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8858 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8859 Lisp_Object conversion, spec; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8860 Lisp_Object mask; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8861 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8862 spec = img->spec; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8863 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8864 /* `:heuristic-mask t' |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8865 `:mask heuristic' |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8866 means build a mask heuristically. |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8867 `:heuristic-mask (R G B)' |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8868 `:mask (heuristic (R G B))' |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8869 means build a mask from color (R G B) in the |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8870 image. |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8871 `:mask nil' |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8872 means remove a mask, if any. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8873 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8874 mask = image_spec_value (spec, QCheuristic_mask, NULL); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8875 if (!NILP (mask)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8876 x_build_heuristic_mask (f, img, mask); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8877 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8878 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8879 int found_p; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8880 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8881 mask = image_spec_value (spec, QCmask, &found_p); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8882 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8883 if (EQ (mask, Qheuristic)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8884 x_build_heuristic_mask (f, img, Qt); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8885 else if (CONSP (mask) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8886 && EQ (XCAR (mask), Qheuristic)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8887 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8888 if (CONSP (XCDR (mask))) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8889 x_build_heuristic_mask (f, img, XCAR (XCDR (mask))); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8890 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8891 x_build_heuristic_mask (f, img, XCDR (mask)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8892 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8893 else if (NILP (mask) && found_p && img->mask) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8894 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8895 XFreePixmap (FRAME_X_DISPLAY (f), img->mask); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8896 img->mask = NULL; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8897 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8898 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8899 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8900 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8901 /* Should we apply an image transformation algorithm? */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8902 conversion = image_spec_value (spec, QCconversion, NULL); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8903 if (EQ (conversion, Qdisabled)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8904 x_disable_image (f, img); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8905 else if (EQ (conversion, Qlaplace)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8906 x_laplace (f, img); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8907 else if (EQ (conversion, Qemboss)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8908 x_emboss (f, img); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8909 else if (CONSP (conversion) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8910 && EQ (XCAR (conversion), Qedge_detection)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8911 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8912 Lisp_Object tem; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8913 tem = XCDR (conversion); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8914 if (CONSP (tem)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8915 x_edge_detection (f, img, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8916 Fplist_get (tem, QCmatrix), |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8917 Fplist_get (tem, QCcolor_adjustment)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8918 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8919 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8920 #endif |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8921 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8922 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8923 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8924 /* Return the id of image with Lisp specification SPEC on frame F. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8925 SPEC must be a valid Lisp image specification (see valid_image_p). */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8926 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8927 int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8928 lookup_image (f, spec) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8929 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8930 Lisp_Object spec; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8931 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8932 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8933 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8934 int i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8935 unsigned hash; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8936 struct gcpro gcpro1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8937 EMACS_TIME now; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8938 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8939 /* F must be a window-system frame, and SPEC must be a valid image |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8940 specification. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8941 xassert (FRAME_WINDOW_P (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8942 xassert (valid_image_p (spec)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8943 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8944 GCPRO1 (spec); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8945 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8946 /* Look up SPEC in the hash table of the image cache. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8947 hash = sxhash (spec, 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8948 i = hash % IMAGE_CACHE_BUCKETS_SIZE; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8949 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8950 for (img = c->buckets[i]; img; img = img->next) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8951 if (img->hash == hash && !NILP (Fequal (img->spec, spec))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8952 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8953 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8954 /* If not found, create a new image and cache it. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8955 if (img == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8956 { |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8957 extern Lisp_Object Qpostscript; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8958 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8959 BLOCK_INPUT; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8960 img = make_image (spec, hash); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8961 cache_image (f, img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8962 img->load_failed_p = img->type->load (f, img) == 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8963 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8964 /* If we can't load the image, and we don't have a width and |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8965 height, use some arbitrary width and height so that we can |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8966 draw a rectangle for it. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8967 if (img->load_failed_p) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8968 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8969 Lisp_Object value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8970 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8971 value = image_spec_value (spec, QCwidth, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8972 img->width = (INTEGERP (value) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8973 ? XFASTINT (value) : DEFAULT_IMAGE_WIDTH); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8974 value = image_spec_value (spec, QCheight, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8975 img->height = (INTEGERP (value) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8976 ? XFASTINT (value) : DEFAULT_IMAGE_HEIGHT); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8977 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8978 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8979 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8980 /* Handle image type independent image attributes |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8981 `:ascent PERCENT', `:margin MARGIN', `:relief RELIEF', |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8982 `:background COLOR'. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8983 Lisp_Object ascent, margin, relief, bg; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8984 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8985 ascent = image_spec_value (spec, QCascent, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8986 if (INTEGERP (ascent)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8987 img->ascent = XFASTINT (ascent); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8988 else if (EQ (ascent, Qcenter)) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8989 img->ascent = CENTERED_IMAGE_ASCENT; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8990 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8991 margin = image_spec_value (spec, QCmargin, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8992 if (INTEGERP (margin) && XINT (margin) >= 0) |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8993 img->vmargin = img->hmargin = XFASTINT (margin); |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8994 else if (CONSP (margin) && INTEGERP (XCAR (margin)) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8995 && INTEGERP (XCDR (margin))) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8996 { |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8997 if (XINT (XCAR (margin)) > 0) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8998 img->hmargin = XFASTINT (XCAR (margin)); |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8999 if (XINT (XCDR (margin)) > 0) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
9000 img->vmargin = XFASTINT (XCDR (margin)); |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
9001 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9002 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9003 relief = image_spec_value (spec, QCrelief, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9004 if (INTEGERP (relief)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9005 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9006 img->relief = XINT (relief); |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
9007 img->hmargin += abs (img->relief); |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
9008 img->vmargin += abs (img->relief); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9009 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9010 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9011 if (! img->background_valid) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9012 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9013 bg = image_spec_value (img->spec, QCbackground, NULL); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9014 if (!NILP (bg)) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9015 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9016 img->background |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9017 = x_alloc_image_color (f, img, bg, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9018 FRAME_BACKGROUND_PIXEL (f)); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9019 img->background_valid = 1; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9020 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9021 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9022 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9023 /* Do image transformations and compute masks, unless we |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9024 don't have the image yet. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9025 if (!EQ (*img->type->type, Qpostscript)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9026 postprocess_image (f, img); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9027 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9028 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
9029 UNBLOCK_INPUT; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
9030 xassert (!interrupt_input_blocked); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9031 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9032 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9033 /* We're using IMG, so set its timestamp to `now'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9034 EMACS_GET_TIME (now); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9035 img->timestamp = EMACS_SECS (now); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9036 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9037 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9038 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9039 /* Value is the image id. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9040 return img->id; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9041 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9042 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9043 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9044 /* Cache image IMG in the image cache of frame F. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9045 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9046 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9047 cache_image (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9048 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9049 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9050 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9051 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9052 int i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9053 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9054 /* Find a free slot in c->images. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9055 for (i = 0; i < c->used; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9056 if (c->images[i] == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9057 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9058 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9059 /* If no free slot found, maybe enlarge c->images. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9060 if (i == c->used && c->used == c->size) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9061 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9062 c->size *= 2; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9063 c->images = (struct image **) xrealloc (c->images, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9064 c->size * sizeof *c->images); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9065 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9066 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9067 /* Add IMG to c->images, and assign IMG an id. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9068 c->images[i] = img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9069 img->id = i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9070 if (i == c->used) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9071 ++c->used; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9072 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9073 /* Add IMG to the cache's hash table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9074 i = img->hash % IMAGE_CACHE_BUCKETS_SIZE; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9075 img->next = c->buckets[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9076 if (img->next) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9077 img->next->prev = img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9078 img->prev = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9079 c->buckets[i] = img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9080 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9081 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9082 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9083 /* Call FN on every image in the image cache of frame F. Used to mark |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9084 Lisp Objects in the image cache. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9085 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9086 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9087 forall_images_in_image_cache (f, fn) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9088 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9089 void (*fn) P_ ((struct image *img)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9090 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9091 if (FRAME_LIVE_P (f) && FRAME_W32_P (f)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9092 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9093 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9094 if (c) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9095 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9096 int i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9097 for (i = 0; i < c->used; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9098 if (c->images[i]) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9099 fn (c->images[i]); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9100 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9101 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9102 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9103 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9104 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9105 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9106 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9107 W32 support code |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9108 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9109 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
9110 #if 0 /* TODO: W32 specific image code. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9111 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9112 static int x_create_x_image_and_pixmap P_ ((struct frame *, int, int, int, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9113 XImage **, Pixmap *)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9114 static void x_destroy_x_image P_ ((XImage *)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9115 static void x_put_x_image P_ ((struct frame *, XImage *, Pixmap, int, int)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9116 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9117 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9118 /* Create an XImage and a pixmap of size WIDTH x HEIGHT for use on |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9119 frame F. Set *XIMG and *PIXMAP to the XImage and Pixmap created. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9120 Set (*XIMG)->data to a raster of WIDTH x HEIGHT pixels allocated |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9121 via xmalloc. Print error messages via image_error if an error |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9122 occurs. Value is non-zero if successful. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9123 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9124 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9125 x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9126 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9127 int width, height, depth; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9128 XImage **ximg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9129 Pixmap *pixmap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9130 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
9131 #if 0 /* TODO: Image support for W32 */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9132 Display *display = FRAME_W32_DISPLAY (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9133 Screen *screen = FRAME_X_SCREEN (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9134 Window window = FRAME_W32_WINDOW (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9135 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9136 xassert (interrupt_input_blocked); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9137 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9138 if (depth <= 0) |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9139 depth = one_w32_display_info.n_cbits; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9140 *ximg = XCreateImage (display, DefaultVisualOfScreen (screen), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9141 depth, ZPixmap, 0, NULL, width, height, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9142 depth > 16 ? 32 : depth > 8 ? 16 : 8, 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9143 if (*ximg == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9144 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9145 image_error ("Unable to allocate X image", Qnil, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9146 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9147 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9148 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9149 /* Allocate image raster. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9150 (*ximg)->data = (char *) xmalloc ((*ximg)->bytes_per_line * height); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9151 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9152 /* Allocate a pixmap of the same size. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9153 *pixmap = XCreatePixmap (display, window, width, height, depth); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9154 if (*pixmap == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9155 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9156 x_destroy_x_image (*ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9157 *ximg = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9158 image_error ("Unable to create X pixmap", Qnil, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9159 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9160 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9161 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9162 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9163 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9164 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9165 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9166 /* Destroy XImage XIMG. Free XIMG->data. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9167 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9168 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9169 x_destroy_x_image (ximg) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9170 XImage *ximg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9171 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9172 xassert (interrupt_input_blocked); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9173 if (ximg) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9174 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9175 xfree (ximg->data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9176 ximg->data = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9177 XDestroyImage (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9178 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9179 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9180 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9181 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9182 /* Put XImage XIMG into pixmap PIXMAP on frame F. WIDTH and HEIGHT |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9183 are width and height of both the image and pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9184 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9185 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9186 x_put_x_image (f, ximg, pixmap, width, height) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9187 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9188 XImage *ximg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9189 Pixmap pixmap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9190 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9191 GC gc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9192 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9193 xassert (interrupt_input_blocked); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9194 gc = XCreateGC (NULL, pixmap, 0, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9195 XPutImage (NULL, pixmap, gc, ximg, 0, 0, 0, 0, width, height); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9196 XFreeGC (NULL, gc); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9197 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9198 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9199 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9200 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9201 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9202 /*********************************************************************** |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9203 File Handling |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9204 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9205 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9206 static Lisp_Object x_find_image_file P_ ((Lisp_Object)); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9207 static char *slurp_file P_ ((char *, int *)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9208 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9209 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9210 /* Find image file FILE. Look in data-directory, then |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9211 x-bitmap-file-path. Value is the full name of the file found, or |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9212 nil if not found. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9213 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9214 static Lisp_Object |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9215 x_find_image_file (file) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9216 Lisp_Object file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9217 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9218 Lisp_Object file_found, search_path; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9219 struct gcpro gcpro1, gcpro2; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9220 int fd; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9221 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9222 file_found = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9223 search_path = Fcons (Vdata_directory, Vx_bitmap_file_path); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9224 GCPRO2 (file_found, search_path); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9225 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9226 /* Try to find FILE in data-directory, then x-bitmap-file-path. */ |
39812
66e0816837a8
Update calls to openp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39548
diff
changeset
|
9227 fd = openp (search_path, file, Qnil, &file_found, 0); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9228 |
33443
2c60aa5cd386
(x_create_bitmap_from_file, x_find_image_file): Use new openp return protocol.
Miles Bader <miles@gnu.org>
parents:
33387
diff
changeset
|
9229 if (fd == -1) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9230 file_found = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9231 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9232 close (fd); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9233 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9234 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9235 return file_found; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9236 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9237 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9238 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9239 /* Read FILE into memory. Value is a pointer to a buffer allocated |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9240 with xmalloc holding FILE's contents. Value is null if an error |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9241 occurred. *SIZE is set to the size of the file. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9242 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9243 static char * |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9244 slurp_file (file, size) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9245 char *file; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9246 int *size; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9247 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9248 FILE *fp = NULL; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9249 char *buf = NULL; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9250 struct stat st; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9251 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9252 if (stat (file, &st) == 0 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9253 && (fp = fopen (file, "r")) != NULL |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9254 && (buf = (char *) xmalloc (st.st_size), |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9255 fread (buf, 1, st.st_size, fp) == st.st_size)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9256 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9257 *size = st.st_size; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9258 fclose (fp); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9259 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9260 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9261 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9262 if (fp) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9263 fclose (fp); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9264 if (buf) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9265 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9266 xfree (buf); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9267 buf = NULL; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9268 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9269 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9270 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9271 return buf; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9272 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9273 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9274 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9275 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9276 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9277 XBM images |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9278 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9279 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9280 static int xbm_load P_ ((struct frame *f, struct image *img)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9281 static int xbm_load_image_from_file P_ ((struct frame *f, struct image *img, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9282 Lisp_Object file)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9283 static int xbm_image_p P_ ((Lisp_Object object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9284 static int xbm_read_bitmap_file_data P_ ((char *, int *, int *, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9285 unsigned char **)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9286 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9287 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9288 /* Indices of image specification fields in xbm_format, below. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9289 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9290 enum xbm_keyword_index |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9291 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9292 XBM_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9293 XBM_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9294 XBM_WIDTH, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9295 XBM_HEIGHT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9296 XBM_DATA, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9297 XBM_FOREGROUND, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9298 XBM_BACKGROUND, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9299 XBM_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9300 XBM_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9301 XBM_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9302 XBM_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9303 XBM_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9304 XBM_MASK, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9305 XBM_LAST |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9306 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9307 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9308 /* Vector of image_keyword structures describing the format |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9309 of valid XBM image specifications. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9310 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9311 static struct image_keyword xbm_format[XBM_LAST] = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9312 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9313 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9314 {":file", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9315 {":width", IMAGE_POSITIVE_INTEGER_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9316 {":height", IMAGE_POSITIVE_INTEGER_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9317 {":data", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9318 {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9319 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9320 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}, |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
9321 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9322 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
9323 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9324 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0} |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9325 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9326 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9327 /* Structure describing the image type XBM. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9328 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9329 static struct image_type xbm_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9330 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9331 &Qxbm, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9332 xbm_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9333 xbm_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9334 x_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9335 NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9336 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9337 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9338 /* Tokens returned from xbm_scan. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9339 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9340 enum xbm_token |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9341 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9342 XBM_TK_IDENT = 256, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9343 XBM_TK_NUMBER |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9344 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9345 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9346 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9347 /* Return non-zero if OBJECT is a valid XBM-type image specification. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9348 A valid specification is a list starting with the symbol `image' |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9349 The rest of the list is a property list which must contain an |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9350 entry `:type xbm.. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9351 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9352 If the specification specifies a file to load, it must contain |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9353 an entry `:file FILENAME' where FILENAME is a string. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9354 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9355 If the specification is for a bitmap loaded from memory it must |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9356 contain `:width WIDTH', `:height HEIGHT', and `:data DATA', where |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9357 WIDTH and HEIGHT are integers > 0. DATA may be: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9358 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9359 1. a string large enough to hold the bitmap data, i.e. it must |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9360 have a size >= (WIDTH + 7) / 8 * HEIGHT |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9361 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9362 2. a bool-vector of size >= WIDTH * HEIGHT |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9363 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9364 3. a vector of strings or bool-vectors, one for each line of the |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9365 bitmap. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9366 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9367 Both the file and data forms may contain the additional entries |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9368 `:background COLOR' and `:foreground COLOR'. If not present, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9369 foreground and background of the frame on which the image is |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9370 displayed, is used. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9371 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9372 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9373 xbm_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9374 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9375 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9376 struct image_keyword kw[XBM_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9377 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9378 bcopy (xbm_format, kw, sizeof kw); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9379 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9380 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9381 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9382 xassert (EQ (kw[XBM_TYPE].value, Qxbm)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9383 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9384 if (kw[XBM_FILE].count) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9385 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9386 if (kw[XBM_WIDTH].count || kw[XBM_HEIGHT].count || kw[XBM_DATA].count) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9387 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9388 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9389 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9390 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9391 Lisp_Object data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9392 int width, height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9393 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9394 /* Entries for `:width', `:height' and `:data' must be present. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9395 if (!kw[XBM_WIDTH].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9396 || !kw[XBM_HEIGHT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9397 || !kw[XBM_DATA].count) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9398 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9399 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9400 data = kw[XBM_DATA].value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9401 width = XFASTINT (kw[XBM_WIDTH].value); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9402 height = XFASTINT (kw[XBM_HEIGHT].value); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9403 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9404 /* Check type of data, and width and height against contents of |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9405 data. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9406 if (VECTORP (data)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9407 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9408 int i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9409 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9410 /* Number of elements of the vector must be >= height. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9411 if (XVECTOR (data)->size < height) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9412 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9413 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9414 /* Each string or bool-vector in data must be large enough |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9415 for one line of the image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9416 for (i = 0; i < height; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9417 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9418 Lisp_Object elt = XVECTOR (data)->contents[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9419 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9420 if (STRINGP (elt)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9421 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9422 if (XSTRING (elt)->size |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9423 < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9424 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9425 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9426 else if (BOOL_VECTOR_P (elt)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9427 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9428 if (XBOOL_VECTOR (elt)->size < width) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9429 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9430 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9431 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9432 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9433 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9434 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9435 else if (STRINGP (data)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9436 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9437 if (XSTRING (data)->size |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9438 < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR * height) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9439 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9440 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9441 else if (BOOL_VECTOR_P (data)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9442 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9443 if (XBOOL_VECTOR (data)->size < width * height) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9444 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9445 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9446 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9447 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9448 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9449 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9450 /* Baseline must be a value between 0 and 100 (a percentage). */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9451 if (kw[XBM_ASCENT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9452 && XFASTINT (kw[XBM_ASCENT].value) > 100) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9453 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9454 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9455 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9456 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9457 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9458 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9459 /* Scan a bitmap file. FP is the stream to read from. Value is |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9460 either an enumerator from enum xbm_token, or a character for a |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9461 single-character token, or 0 at end of file. If scanning an |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9462 identifier, store the lexeme of the identifier in SVAL. If |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9463 scanning a number, store its value in *IVAL. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9464 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9465 static int |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9466 xbm_scan (s, end, sval, ival) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9467 char **s, *end; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9468 char *sval; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9469 int *ival; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9470 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9471 int c; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9472 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9473 loop: |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9474 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9475 /* Skip white space. */ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9476 while (*s < end &&(c = *(*s)++, isspace (c))) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9477 ; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9478 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9479 if (*s >= end) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9480 c = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9481 else if (isdigit (c)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9482 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9483 int value = 0, digit; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9484 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9485 if (c == '0' && *s < end) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9486 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9487 c = *(*s)++; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9488 if (c == 'x' || c == 'X') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9489 { |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9490 while (*s < end) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9491 { |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9492 c = *(*s)++; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9493 if (isdigit (c)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9494 digit = c - '0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9495 else if (c >= 'a' && c <= 'f') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9496 digit = c - 'a' + 10; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9497 else if (c >= 'A' && c <= 'F') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9498 digit = c - 'A' + 10; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9499 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9500 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9501 value = 16 * value + digit; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9502 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9503 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9504 else if (isdigit (c)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9505 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9506 value = c - '0'; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9507 while (*s < end |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9508 && (c = *(*s)++, isdigit (c))) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9509 value = 8 * value + c - '0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9510 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9511 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9512 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9513 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9514 value = c - '0'; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9515 while (*s < end |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9516 && (c = *(*s)++, isdigit (c))) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9517 value = 10 * value + c - '0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9518 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9519 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9520 if (*s < end) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9521 *s = *s - 1; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9522 *ival = value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9523 c = XBM_TK_NUMBER; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9524 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9525 else if (isalpha (c) || c == '_') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9526 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9527 *sval++ = c; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9528 while (*s < end |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9529 && (c = *(*s)++, (isalnum (c) || c == '_'))) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9530 *sval++ = c; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9531 *sval = 0; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9532 if (*s < end) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9533 *s = *s - 1; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9534 c = XBM_TK_IDENT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9535 } |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9536 else if (c == '/' && **s == '*') |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9537 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9538 /* C-style comment. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9539 ++*s; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9540 while (**s && (**s != '*' || *(*s + 1) != '/')) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9541 ++*s; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9542 if (**s) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9543 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9544 *s += 2; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9545 goto loop; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9546 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9547 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9548 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9549 return c; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9550 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9551 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9552 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9553 /* Replacement for XReadBitmapFileData which isn't available under old |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9554 X versions. CONTENTS is a pointer to a buffer to parse; END is the |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9555 buffer's end. Set *WIDTH and *HEIGHT to the width and height of |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9556 the image. Return in *DATA the bitmap data allocated with xmalloc. |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9557 Value is non-zero if successful. DATA null means just test if |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9558 CONTENTS looks like an in-memory XBM file. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9559 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9560 static int |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9561 xbm_read_bitmap_data (contents, end, width, height, data) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9562 char *contents, *end; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9563 int *width, *height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9564 unsigned char **data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9565 { |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9566 char *s = contents; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9567 char buffer[BUFSIZ]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9568 int padding_p = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9569 int v10 = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9570 int bytes_per_line, i, nbytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9571 unsigned char *p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9572 int value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9573 int LA1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9574 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9575 #define match() \ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9576 LA1 = xbm_scan (contents, end, buffer, &value) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9577 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9578 #define expect(TOKEN) \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9579 if (LA1 != (TOKEN)) \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9580 goto failure; \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9581 else \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9582 match () |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9583 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9584 #define expect_ident(IDENT) \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9585 if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9586 match (); \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9587 else \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9588 goto failure |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9589 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9590 *width = *height = -1; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9591 if (data) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9592 *data = NULL; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9593 LA1 = xbm_scan (&s, end, buffer, &value); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9594 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9595 /* Parse defines for width, height and hot-spots. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9596 while (LA1 == '#') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9597 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9598 match (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9599 expect_ident ("define"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9600 expect (XBM_TK_IDENT); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9601 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9602 if (LA1 == XBM_TK_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9603 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9604 char *p = strrchr (buffer, '_'); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9605 p = p ? p + 1 : buffer; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9606 if (strcmp (p, "width") == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9607 *width = value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9608 else if (strcmp (p, "height") == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9609 *height = value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9610 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9611 expect (XBM_TK_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9612 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9613 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9614 if (*width < 0 || *height < 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9615 goto failure; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9616 else if (data == NULL) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9617 goto success; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9618 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9619 /* Parse bits. Must start with `static'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9620 expect_ident ("static"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9621 if (LA1 == XBM_TK_IDENT) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9622 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9623 if (strcmp (buffer, "unsigned") == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9624 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9625 match (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9626 expect_ident ("char"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9627 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9628 else if (strcmp (buffer, "short") == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9629 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9630 match (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9631 v10 = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9632 if (*width % 16 && *width % 16 < 9) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9633 padding_p = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9634 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9635 else if (strcmp (buffer, "char") == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9636 match (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9637 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9638 goto failure; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9639 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9640 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9641 goto failure; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9642 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9643 expect (XBM_TK_IDENT); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9644 expect ('['); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9645 expect (']'); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9646 expect ('='); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9647 expect ('{'); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9648 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9649 bytes_per_line = (*width + 7) / 8 + padding_p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9650 nbytes = bytes_per_line * *height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9651 p = *data = (char *) xmalloc (nbytes); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9652 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9653 if (v10) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9654 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9655 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9656 for (i = 0; i < nbytes; i += 2) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9657 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9658 int val = value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9659 expect (XBM_TK_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9660 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9661 *p++ = val; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9662 if (!padding_p || ((i + 2) % bytes_per_line)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9663 *p++ = value >> 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9664 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9665 if (LA1 == ',' || LA1 == '}') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9666 match (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9667 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9668 goto failure; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9669 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9670 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9671 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9672 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9673 for (i = 0; i < nbytes; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9674 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9675 int val = value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9676 expect (XBM_TK_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9677 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9678 *p++ = val; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9679 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9680 if (LA1 == ',' || LA1 == '}') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9681 match (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9682 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9683 goto failure; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9684 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9685 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9686 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9687 success: |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9688 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9689 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9690 failure: |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9691 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9692 if (data && *data) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9693 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9694 xfree (*data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9695 *data = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9696 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9697 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9698 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9699 #undef match |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9700 #undef expect |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9701 #undef expect_ident |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9702 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9703 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9704 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9705 /* Load XBM image IMG which will be displayed on frame F from buffer |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9706 CONTENTS. END is the end of the buffer. Value is non-zero if |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9707 successful. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9708 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9709 static int |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9710 xbm_load_image (f, img, contents, end) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9711 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9712 struct image *img; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9713 char *contents, *end; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9714 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9715 int rc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9716 unsigned char *data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9717 int success_p = 0; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9718 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9719 rc = xbm_read_bitmap_data (contents, end, &img->width, &img->height, &data); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9720 if (rc) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9721 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9722 int depth = one_w32_display_info.n_cbits; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9723 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9724 unsigned long background = FRAME_BACKGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9725 Lisp_Object value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9726 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9727 xassert (img->width > 0 && img->height > 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9728 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9729 /* Get foreground and background colors, maybe allocate colors. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9730 value = image_spec_value (img->spec, QCforeground, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9731 if (!NILP (value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9732 foreground = x_alloc_image_color (f, img, value, foreground); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9733 value = image_spec_value (img->spec, QCbackground, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9734 if (!NILP (value)) |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9735 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9736 background = x_alloc_image_color (f, img, value, background); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9737 img->background = background; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9738 img->background_valid = 1; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9739 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9740 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
9741 #if 0 /* TODO : Port image display to W32 */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9742 img->pixmap |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9743 = XCreatePixmapFromBitmapData (FRAME_W32_DISPLAY (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9744 FRAME_W32_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9745 data, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9746 img->width, img->height, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9747 foreground, background, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9748 depth); |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9749 #endif |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9750 xfree (data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9751 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9752 if (img->pixmap == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9753 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9754 x_clear_image (f, img); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9755 image_error ("Unable to create X pixmap for `%s'", img->spec, Qnil); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9756 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9757 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9758 success_p = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9759 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9760 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9761 image_error ("Error loading XBM image `%s'", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9762 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9763 return success_p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9764 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9765 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9766 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9767 /* Value is non-zero if DATA looks like an in-memory XBM file. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9768 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9769 static int |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9770 xbm_file_p (data) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9771 Lisp_Object data; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9772 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9773 int w, h; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9774 return (STRINGP (data) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9775 && xbm_read_bitmap_data (XSTRING (data)->data, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9776 (XSTRING (data)->data |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9777 + STRING_BYTES (XSTRING (data))), |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9778 &w, &h, NULL)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9779 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9780 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9781 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9782 /* Fill image IMG which is used on frame F with pixmap data. Value is |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9783 non-zero if successful. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9784 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9785 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9786 xbm_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9787 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9788 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9789 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9790 int success_p = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9791 Lisp_Object file_name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9792 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9793 xassert (xbm_image_p (img->spec)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9794 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9795 /* If IMG->spec specifies a file name, create a non-file spec from it. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9796 file_name = image_spec_value (img->spec, QCfile, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9797 if (STRINGP (file_name)) |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9798 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9799 Lisp_Object file; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9800 char *contents; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9801 int size; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9802 struct gcpro gcpro1; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9803 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9804 file = x_find_image_file (file_name); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9805 GCPRO1 (file); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9806 if (!STRINGP (file)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9807 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9808 image_error ("Cannot find image file `%s'", file_name, Qnil); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9809 UNGCPRO; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9810 return 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9811 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9812 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9813 contents = slurp_file (XSTRING (file)->data, &size); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9814 if (contents == NULL) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9815 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9816 image_error ("Error loading XBM image `%s'", img->spec, Qnil); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9817 UNGCPRO; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9818 return 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9819 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9820 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9821 success_p = xbm_load_image (f, img, contents, contents + size); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9822 UNGCPRO; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9823 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9824 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9825 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9826 struct image_keyword fmt[XBM_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9827 Lisp_Object data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9828 int depth; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9829 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9830 unsigned long background = FRAME_BACKGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9831 char *bits; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9832 int parsed_p; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9833 int in_memory_file_p = 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9834 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9835 /* See if data looks like an in-memory XBM file. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9836 data = image_spec_value (img->spec, QCdata, NULL); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9837 in_memory_file_p = xbm_file_p (data); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9838 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9839 /* Parse the list specification. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9840 bcopy (xbm_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9841 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9842 xassert (parsed_p); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9843 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9844 /* Get specified width, and height. */ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9845 if (!in_memory_file_p) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9846 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9847 img->width = XFASTINT (fmt[XBM_WIDTH].value); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9848 img->height = XFASTINT (fmt[XBM_HEIGHT].value); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9849 xassert (img->width > 0 && img->height > 0); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9850 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9851 /* Get foreground and background colors, maybe allocate colors. */ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9852 if (fmt[XBM_FOREGROUND].count |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9853 && STRINGP (fmt[XBM_FOREGROUND].value)) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9854 foreground = x_alloc_image_color (f, img, fmt[XBM_FOREGROUND].value, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9855 foreground); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9856 if (fmt[XBM_BACKGROUND].count |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9857 && STRINGP (fmt[XBM_BACKGROUND].value)) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9858 background = x_alloc_image_color (f, img, fmt[XBM_BACKGROUND].value, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9859 background); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9860 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9861 if (in_memory_file_p) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9862 success_p = xbm_load_image (f, img, XSTRING (data)->data, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9863 (XSTRING (data)->data |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9864 + STRING_BYTES (XSTRING (data)))); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9865 else |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9866 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9867 if (VECTORP (data)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9868 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9869 int i; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9870 char *p; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9871 int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9872 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9873 p = bits = (char *) alloca (nbytes * img->height); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9874 for (i = 0; i < img->height; ++i, p += nbytes) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9875 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9876 Lisp_Object line = XVECTOR (data)->contents[i]; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9877 if (STRINGP (line)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9878 bcopy (XSTRING (line)->data, p, nbytes); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9879 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9880 bcopy (XBOOL_VECTOR (line)->data, p, nbytes); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9881 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9882 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9883 else if (STRINGP (data)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9884 bits = XSTRING (data)->data; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9885 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9886 bits = XBOOL_VECTOR (data)->data; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9887 #ifdef TODO /* image support. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9888 /* Create the pixmap. */ |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9889 depth = one_w32_display_info.n_cbits; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9890 img->pixmap |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9891 = XCreatePixmapFromBitmapData (FRAME_X_DISPLAY (f), |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9892 FRAME_X_WINDOW (f), |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9893 bits, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9894 img->width, img->height, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9895 foreground, background, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9896 depth); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9897 #endif |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9898 if (img->pixmap) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9899 success_p = 1; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9900 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9901 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9902 image_error ("Unable to create pixmap for XBM image `%s'", |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9903 img->spec, Qnil); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9904 x_clear_image (f, img); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9905 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9906 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9907 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9908 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9909 return success_p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9910 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9911 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9912 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9913 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9914 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9915 XPM images |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9916 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9917 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9918 #if HAVE_XPM |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9919 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9920 static int xpm_image_p P_ ((Lisp_Object object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9921 static int xpm_load P_ ((struct frame *f, struct image *img)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9922 static int xpm_valid_color_symbols_p P_ ((Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9923 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9924 #include "X11/xpm.h" |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9925 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9926 /* The symbol `xpm' identifying XPM-format images. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9927 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9928 Lisp_Object Qxpm; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9929 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9930 /* Indices of image specification fields in xpm_format, below. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9931 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9932 enum xpm_keyword_index |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9933 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9934 XPM_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9935 XPM_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9936 XPM_DATA, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9937 XPM_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9938 XPM_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9939 XPM_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9940 XPM_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9941 XPM_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9942 XPM_MASK, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9943 XPM_COLOR_SYMBOLS, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9944 XPM_BACKGROUND, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9945 XPM_LAST |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9946 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9947 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9948 /* Vector of image_keyword structures describing the format |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9949 of valid XPM image specifications. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9950 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9951 static struct image_keyword xpm_format[XPM_LAST] = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9952 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9953 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9954 {":file", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9955 {":data", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9956 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}, |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
9957 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9958 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
9959 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9960 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9961 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9962 {":color-symbols", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9963 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9964 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9965 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9966 /* Structure describing the image type XBM. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9967 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9968 static struct image_type xpm_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9969 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9970 &Qxpm, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9971 xpm_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9972 xpm_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9973 x_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9974 NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9975 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9976 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9977 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9978 /* Value is non-zero if COLOR_SYMBOLS is a valid color symbols list |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9979 for XPM images. Such a list must consist of conses whose car and |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9980 cdr are strings. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9981 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9982 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9983 xpm_valid_color_symbols_p (color_symbols) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9984 Lisp_Object color_symbols; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9985 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9986 while (CONSP (color_symbols)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9987 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9988 Lisp_Object sym = XCAR (color_symbols); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9989 if (!CONSP (sym) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9990 || !STRINGP (XCAR (sym)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9991 || !STRINGP (XCDR (sym))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9992 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9993 color_symbols = XCDR (color_symbols); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9994 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9995 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9996 return NILP (color_symbols); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9997 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9998 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9999 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10000 /* Value is non-zero if OBJECT is a valid XPM image specification. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10001 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10002 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10003 xpm_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10004 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10005 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10006 struct image_keyword fmt[XPM_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10007 bcopy (xpm_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10008 return (parse_image_spec (object, fmt, XPM_LAST, Qxpm) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10009 /* Either `:file' or `:data' must be present. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10010 && fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10011 /* Either no `:color-symbols' or it's a list of conses |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10012 whose car and cdr are strings. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10013 && (fmt[XPM_COLOR_SYMBOLS].count == 0 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10014 || xpm_valid_color_symbols_p (fmt[XPM_COLOR_SYMBOLS].value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10015 && (fmt[XPM_ASCENT].count == 0 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10016 || XFASTINT (fmt[XPM_ASCENT].value) < 100)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10017 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10018 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10019 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10020 /* Load image IMG which will be displayed on frame F. Value is |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10021 non-zero if successful. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10022 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10023 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10024 xpm_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10025 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10026 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10027 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10028 int rc, i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10029 XpmAttributes attrs; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10030 Lisp_Object specified_file, color_symbols; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10031 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10032 /* Configure the XPM lib. Use the visual of frame F. Allocate |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10033 close colors. Return colors allocated. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10034 bzero (&attrs, sizeof attrs); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
10035 attrs.visual = FRAME_X_VISUAL (f); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
10036 attrs.colormap = FRAME_X_COLORMAP (f); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10037 attrs.valuemask |= XpmVisual; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
10038 attrs.valuemask |= XpmColormap; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10039 attrs.valuemask |= XpmReturnAllocPixels; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
10040 #ifdef XpmAllocCloseColors |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10041 attrs.alloc_close_colors = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10042 attrs.valuemask |= XpmAllocCloseColors; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
10043 #else |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
10044 attrs.closeness = 600; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
10045 attrs.valuemask |= XpmCloseness; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
10046 #endif |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10047 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10048 /* If image specification contains symbolic color definitions, add |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10049 these to `attrs'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10050 color_symbols = image_spec_value (img->spec, QCcolor_symbols, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10051 if (CONSP (color_symbols)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10052 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10053 Lisp_Object tail; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10054 XpmColorSymbol *xpm_syms; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10055 int i, size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10056 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10057 attrs.valuemask |= XpmColorSymbols; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10058 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10059 /* Count number of symbols. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10060 attrs.numsymbols = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10061 for (tail = color_symbols; CONSP (tail); tail = XCDR (tail)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10062 ++attrs.numsymbols; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10063 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10064 /* Allocate an XpmColorSymbol array. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10065 size = attrs.numsymbols * sizeof *xpm_syms; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10066 xpm_syms = (XpmColorSymbol *) alloca (size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10067 bzero (xpm_syms, size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10068 attrs.colorsymbols = xpm_syms; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10069 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10070 /* Fill the color symbol array. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10071 for (tail = color_symbols, i = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10072 CONSP (tail); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10073 ++i, tail = XCDR (tail)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10074 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10075 Lisp_Object name = XCAR (XCAR (tail)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10076 Lisp_Object color = XCDR (XCAR (tail)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10077 xpm_syms[i].name = (char *) alloca (XSTRING (name)->size + 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10078 strcpy (xpm_syms[i].name, XSTRING (name)->data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10079 xpm_syms[i].value = (char *) alloca (XSTRING (color)->size + 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10080 strcpy (xpm_syms[i].value, XSTRING (color)->data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10081 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10082 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10083 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10084 /* Create a pixmap for the image, either from a file, or from a |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10085 string buffer containing data in the same format as an XPM file. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10086 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10087 specified_file = image_spec_value (img->spec, QCfile, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10088 if (STRINGP (specified_file)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10089 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10090 Lisp_Object file = x_find_image_file (specified_file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10091 if (!STRINGP (file)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10092 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10093 image_error ("Cannot find image file `%s'", specified_file, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10094 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10095 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10096 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10097 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10098 rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10099 XSTRING (file)->data, &img->pixmap, &img->mask, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10100 &attrs); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10101 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10102 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10103 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10104 Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10105 rc = XpmCreatePixmapFromBuffer (NULL, FRAME_W32_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10106 XSTRING (buffer)->data, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10107 &img->pixmap, &img->mask, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10108 &attrs); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10109 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10110 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10111 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10112 if (rc == XpmSuccess) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10113 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10114 /* Remember allocated colors. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10115 img->ncolors = attrs.nalloc_pixels; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10116 img->colors = (unsigned long *) xmalloc (img->ncolors |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10117 * sizeof *img->colors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10118 for (i = 0; i < attrs.nalloc_pixels; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10119 img->colors[i] = attrs.alloc_pixels[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10120 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10121 img->width = attrs.width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10122 img->height = attrs.height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10123 xassert (img->width > 0 && img->height > 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10124 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10125 /* The call to XpmFreeAttributes below frees attrs.alloc_pixels. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10126 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10127 XpmFreeAttributes (&attrs); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10128 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10129 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10130 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10131 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10132 switch (rc) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10133 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10134 case XpmOpenFailed: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10135 image_error ("Error opening XPM file (%s)", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10136 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10137 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10138 case XpmFileInvalid: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10139 image_error ("Invalid XPM file (%s)", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10140 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10141 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10142 case XpmNoMemory: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10143 image_error ("Out of memory (%s)", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10144 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10145 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10146 case XpmColorFailed: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10147 image_error ("Color allocation error (%s)", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10148 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10149 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10150 default: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10151 image_error ("Unknown error (%s)", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10152 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10153 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10154 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10155 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10156 return rc == XpmSuccess; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10157 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10158 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10159 #endif /* HAVE_XPM != 0 */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10160 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10161 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
10162 #if 0 /* TODO : Color tables on W32. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10163 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10164 Color table |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10165 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10166 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10167 /* An entry in the color table mapping an RGB color to a pixel color. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10168 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10169 struct ct_color |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10170 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10171 int r, g, b; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10172 unsigned long pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10173 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10174 /* Next in color table collision list. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10175 struct ct_color *next; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10176 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10177 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10178 /* The bucket vector size to use. Must be prime. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10179 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10180 #define CT_SIZE 101 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10181 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10182 /* Value is a hash of the RGB color given by R, G, and B. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10183 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10184 #define CT_HASH_RGB(R, G, B) (((R) << 16) ^ ((G) << 8) ^ (B)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10185 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10186 /* The color hash table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10187 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10188 struct ct_color **ct_table; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10189 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10190 /* Number of entries in the color table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10191 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10192 int ct_colors_allocated; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10193 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10194 /* Function prototypes. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10195 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10196 static void init_color_table P_ ((void)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10197 static void free_color_table P_ ((void)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10198 static unsigned long *colors_in_color_table P_ ((int *n)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10199 static unsigned long lookup_rgb_color P_ ((struct frame *f, int r, int g, int b)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10200 static unsigned long lookup_pixel_color P_ ((struct frame *f, unsigned long p)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10201 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10202 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10203 /* Initialize the color table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10204 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10205 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10206 init_color_table () |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10207 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10208 int size = CT_SIZE * sizeof (*ct_table); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10209 ct_table = (struct ct_color **) xmalloc (size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10210 bzero (ct_table, size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10211 ct_colors_allocated = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10212 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10213 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10214 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10215 /* Free memory associated with the color table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10216 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10217 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10218 free_color_table () |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10219 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10220 int i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10221 struct ct_color *p, *next; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10222 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10223 for (i = 0; i < CT_SIZE; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10224 for (p = ct_table[i]; p; p = next) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10225 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10226 next = p->next; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10227 xfree (p); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10228 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10229 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10230 xfree (ct_table); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10231 ct_table = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10232 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10233 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10234 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10235 /* Value is a pixel color for RGB color R, G, B on frame F. If an |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10236 entry for that color already is in the color table, return the |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10237 pixel color of that entry. Otherwise, allocate a new color for R, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10238 G, B, and make an entry in the color table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10239 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10240 static unsigned long |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10241 lookup_rgb_color (f, r, g, b) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10242 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10243 int r, g, b; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10244 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10245 unsigned hash = CT_HASH_RGB (r, g, b); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10246 int i = hash % CT_SIZE; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10247 struct ct_color *p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10248 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10249 for (p = ct_table[i]; p; p = p->next) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10250 if (p->r == r && p->g == g && p->b == b) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10251 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10252 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10253 if (p == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10254 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10255 COLORREF color; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10256 Colormap cmap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10257 int rc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10258 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10259 color = PALETTERGB (r, g, b); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10260 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10261 ++ct_colors_allocated; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10262 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10263 p = (struct ct_color *) xmalloc (sizeof *p); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10264 p->r = r; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10265 p->g = g; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10266 p->b = b; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10267 p->pixel = color; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10268 p->next = ct_table[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10269 ct_table[i] = p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10270 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10271 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10272 return p->pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10273 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10274 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10275 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10276 /* Look up pixel color PIXEL which is used on frame F in the color |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10277 table. If not already present, allocate it. Value is PIXEL. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10278 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10279 static unsigned long |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10280 lookup_pixel_color (f, pixel) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10281 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10282 unsigned long pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10283 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10284 int i = pixel % CT_SIZE; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10285 struct ct_color *p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10286 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10287 for (p = ct_table[i]; p; p = p->next) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10288 if (p->pixel == pixel) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10289 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10290 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10291 if (p == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10292 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10293 XColor color; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10294 Colormap cmap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10295 int rc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10296 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10297 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10298 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10299 cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10300 color.pixel = pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10301 XQueryColor (NULL, cmap, &color); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10302 rc = x_alloc_nearest_color (f, cmap, &color); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10303 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10304 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10305 if (rc) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10306 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10307 ++ct_colors_allocated; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10308 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10309 p = (struct ct_color *) xmalloc (sizeof *p); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10310 p->r = color.red; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10311 p->g = color.green; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10312 p->b = color.blue; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10313 p->pixel = pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10314 p->next = ct_table[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10315 ct_table[i] = p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10316 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10317 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10318 return FRAME_FOREGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10319 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10320 return p->pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10321 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10322 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10323 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10324 /* Value is a vector of all pixel colors contained in the color table, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10325 allocated via xmalloc. Set *N to the number of colors. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10326 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10327 static unsigned long * |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10328 colors_in_color_table (n) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10329 int *n; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10330 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10331 int i, j; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10332 struct ct_color *p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10333 unsigned long *colors; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10334 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10335 if (ct_colors_allocated == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10336 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10337 *n = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10338 colors = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10339 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10340 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10341 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10342 colors = (unsigned long *) xmalloc (ct_colors_allocated |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10343 * sizeof *colors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10344 *n = ct_colors_allocated; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10345 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10346 for (i = j = 0; i < CT_SIZE; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10347 for (p = ct_table[i]; p; p = p->next) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10348 colors[j++] = p->pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10349 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10350 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10351 return colors; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10352 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10353 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
10354 #endif /* TODO */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10355 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10356 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10357 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10358 Algorithms |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10359 ***********************************************************************/ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10360 #if 0 /* TODO: image support. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10361 static XColor *x_to_xcolors P_ ((struct frame *, struct image *, int)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10362 static void x_from_xcolors P_ ((struct frame *, struct image *, XColor *)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10363 static void x_detect_edges P_ ((struct frame *, struct image *, int[9], int)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10364 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10365 /* Non-zero means draw a cross on images having `:conversion |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10366 disabled'. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10367 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10368 int cross_disabled_images; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10369 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10370 /* Edge detection matrices for different edge-detection |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10371 strategies. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10372 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10373 static int emboss_matrix[9] = { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10374 /* x - 1 x x + 1 */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10375 2, -1, 0, /* y - 1 */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10376 -1, 0, 1, /* y */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10377 0, 1, -2 /* y + 1 */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10378 }; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10379 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10380 static int laplace_matrix[9] = { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10381 /* x - 1 x x + 1 */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10382 1, 0, 0, /* y - 1 */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10383 0, 0, 0, /* y */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10384 0, 0, -1 /* y + 1 */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10385 }; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10386 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10387 /* Value is the intensity of the color whose red/green/blue values |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10388 are R, G, and B. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10389 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10390 #define COLOR_INTENSITY(R, G, B) ((2 * (R) + 3 * (G) + (B)) / 6) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10391 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10392 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10393 /* On frame F, return an array of XColor structures describing image |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10394 IMG->pixmap. Each XColor structure has its pixel color set. RGB_P |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10395 non-zero means also fill the red/green/blue members of the XColor |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10396 structures. Value is a pointer to the array of XColors structures, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10397 allocated with xmalloc; it must be freed by the caller. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10398 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10399 static XColor * |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10400 x_to_xcolors (f, img, rgb_p) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10401 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10402 struct image *img; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10403 int rgb_p; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10404 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10405 int x, y; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10406 XColor *colors, *p; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10407 XImage *ximg; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10408 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10409 colors = (XColor *) xmalloc (img->width * img->height * sizeof *colors); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10410 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10411 /* Get the X image IMG->pixmap. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10412 ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10413 0, 0, img->width, img->height, ~0, ZPixmap); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10414 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10415 /* Fill the `pixel' members of the XColor array. I wished there |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10416 were an easy and portable way to circumvent XGetPixel. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10417 p = colors; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10418 for (y = 0; y < img->height; ++y) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10419 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10420 XColor *row = p; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10421 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10422 for (x = 0; x < img->width; ++x, ++p) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10423 p->pixel = XGetPixel (ximg, x, y); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10424 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10425 if (rgb_p) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10426 x_query_colors (f, row, img->width); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10427 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10428 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10429 XDestroyImage (ximg); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10430 return colors; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10431 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10432 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10433 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10434 /* Create IMG->pixmap from an array COLORS of XColor structures, whose |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10435 RGB members are set. F is the frame on which this all happens. |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10436 COLORS will be freed; an existing IMG->pixmap will be freed, too. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10437 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10438 static void |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10439 x_from_xcolors (f, img, colors) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10440 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10441 struct image *img; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10442 XColor *colors; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10443 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10444 int x, y; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10445 XImage *oimg; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10446 Pixmap pixmap; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10447 XColor *p; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10448 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10449 init_color_table (); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10450 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10451 x_create_x_image_and_pixmap (f, img->width, img->height, 0, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10452 &oimg, &pixmap); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10453 p = colors; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10454 for (y = 0; y < img->height; ++y) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10455 for (x = 0; x < img->width; ++x, ++p) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10456 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10457 unsigned long pixel; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10458 pixel = lookup_rgb_color (f, p->red, p->green, p->blue); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10459 XPutPixel (oimg, x, y, pixel); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10460 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10461 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10462 xfree (colors); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10463 x_clear_image_1 (f, img, 1, 0, 1); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10464 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10465 x_put_x_image (f, oimg, pixmap, img->width, img->height); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10466 x_destroy_x_image (oimg); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10467 img->pixmap = pixmap; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10468 img->colors = colors_in_color_table (&img->ncolors); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10469 free_color_table (); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10470 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10471 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10472 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10473 /* On frame F, perform edge-detection on image IMG. |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10474 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10475 MATRIX is a nine-element array specifying the transformation |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10476 matrix. See emboss_matrix for an example. |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10477 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10478 COLOR_ADJUST is a color adjustment added to each pixel of the |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10479 outgoing image. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10480 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10481 static void |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10482 x_detect_edges (f, img, matrix, color_adjust) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10483 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10484 struct image *img; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10485 int matrix[9], color_adjust; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10486 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10487 XColor *colors = x_to_xcolors (f, img, 1); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10488 XColor *new, *p; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10489 int x, y, i, sum; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10490 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10491 for (i = sum = 0; i < 9; ++i) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10492 sum += abs (matrix[i]); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10493 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10494 #define COLOR(A, X, Y) ((A) + (Y) * img->width + (X)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10495 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10496 new = (XColor *) xmalloc (img->width * img->height * sizeof *new); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10497 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10498 for (y = 0; y < img->height; ++y) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10499 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10500 p = COLOR (new, 0, y); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10501 p->red = p->green = p->blue = 0xffff/2; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10502 p = COLOR (new, img->width - 1, y); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10503 p->red = p->green = p->blue = 0xffff/2; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10504 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10505 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10506 for (x = 1; x < img->width - 1; ++x) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10507 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10508 p = COLOR (new, x, 0); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10509 p->red = p->green = p->blue = 0xffff/2; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10510 p = COLOR (new, x, img->height - 1); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10511 p->red = p->green = p->blue = 0xffff/2; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10512 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10513 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10514 for (y = 1; y < img->height - 1; ++y) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10515 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10516 p = COLOR (new, 1, y); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10517 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10518 for (x = 1; x < img->width - 1; ++x, ++p) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10519 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10520 int r, g, b, y1, x1; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10521 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10522 r = g = b = i = 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10523 for (y1 = y - 1; y1 < y + 2; ++y1) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10524 for (x1 = x - 1; x1 < x + 2; ++x1, ++i) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10525 if (matrix[i]) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10526 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10527 XColor *t = COLOR (colors, x1, y1); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10528 r += matrix[i] * t->red; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10529 g += matrix[i] * t->green; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10530 b += matrix[i] * t->blue; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10531 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10532 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10533 r = (r / sum + color_adjust) & 0xffff; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10534 g = (g / sum + color_adjust) & 0xffff; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10535 b = (b / sum + color_adjust) & 0xffff; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10536 p->red = p->green = p->blue = COLOR_INTENSITY (r, g, b); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10537 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10538 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10539 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10540 xfree (colors); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10541 x_from_xcolors (f, img, new); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10542 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10543 #undef COLOR |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10544 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10545 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10546 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10547 /* Perform the pre-defined `emboss' edge-detection on image IMG |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10548 on frame F. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10549 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10550 static void |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10551 x_emboss (f, img) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10552 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10553 struct image *img; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10554 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10555 x_detect_edges (f, img, emboss_matrix, 0xffff / 2); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10556 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10557 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10558 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10559 /* Transform image IMG which is used on frame F with a Laplace |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10560 edge-detection algorithm. The result is an image that can be used |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10561 to draw disabled buttons, for example. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10562 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10563 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10564 x_laplace (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10565 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10566 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10567 { |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10568 x_detect_edges (f, img, laplace_matrix, 45000); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10569 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10570 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10571 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10572 /* Perform edge-detection on image IMG on frame F, with specified |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10573 transformation matrix MATRIX and color-adjustment COLOR_ADJUST. |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10574 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10575 MATRIX must be either |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10576 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10577 - a list of at least 9 numbers in row-major form |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10578 - a vector of at least 9 numbers |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10579 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10580 COLOR_ADJUST nil means use a default; otherwise it must be a |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10581 number. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10582 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10583 static void |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10584 x_edge_detection (f, img, matrix, color_adjust) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10585 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10586 struct image *img; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10587 Lisp_Object matrix, color_adjust; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10588 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10589 int i = 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10590 int trans[9]; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10591 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10592 if (CONSP (matrix)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10593 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10594 for (i = 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10595 i < 9 && CONSP (matrix) && NUMBERP (XCAR (matrix)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10596 ++i, matrix = XCDR (matrix)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10597 trans[i] = XFLOATINT (XCAR (matrix)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10598 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10599 else if (VECTORP (matrix) && ASIZE (matrix) >= 9) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10600 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10601 for (i = 0; i < 9 && NUMBERP (AREF (matrix, i)); ++i) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10602 trans[i] = XFLOATINT (AREF (matrix, i)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10603 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10604 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10605 if (NILP (color_adjust)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10606 color_adjust = make_number (0xffff / 2); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10607 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10608 if (i == 9 && NUMBERP (color_adjust)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10609 x_detect_edges (f, img, trans, (int) XFLOATINT (color_adjust)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10610 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10611 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10612 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10613 /* Transform image IMG on frame F so that it looks disabled. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10614 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10615 static void |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10616 x_disable_image (f, img) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10617 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10618 struct image *img; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10619 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10620 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10621 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10622 if (dpyinfo->n_planes >= 2) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10623 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10624 /* Color (or grayscale). Convert to gray, and equalize. Just |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10625 drawing such images with a stipple can look very odd, so |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10626 we're using this method instead. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10627 XColor *colors = x_to_xcolors (f, img, 1); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10628 XColor *p, *end; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10629 const int h = 15000; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10630 const int l = 30000; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10631 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10632 for (p = colors, end = colors + img->width * img->height; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10633 p < end; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10634 ++p) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10635 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10636 int i = COLOR_INTENSITY (p->red, p->green, p->blue); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10637 int i2 = (0xffff - h - l) * i / 0xffff + l; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10638 p->red = p->green = p->blue = i2; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10639 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10640 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10641 x_from_xcolors (f, img, colors); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10642 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10643 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10644 /* Draw a cross over the disabled image, if we must or if we |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10645 should. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10646 if (dpyinfo->n_planes < 2 || cross_disabled_images) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10647 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10648 Display *dpy = FRAME_X_DISPLAY (f); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10649 GC gc; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10650 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10651 gc = XCreateGC (dpy, img->pixmap, 0, NULL); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10652 XSetForeground (dpy, gc, BLACK_PIX_DEFAULT (f)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10653 XDrawLine (dpy, img->pixmap, gc, 0, 0, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10654 img->width - 1, img->height - 1); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10655 XDrawLine (dpy, img->pixmap, gc, 0, img->height - 1, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10656 img->width - 1, 0); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10657 XFreeGC (dpy, gc); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10658 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10659 if (img->mask) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10660 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10661 gc = XCreateGC (dpy, img->mask, 0, NULL); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10662 XSetForeground (dpy, gc, WHITE_PIX_DEFAULT (f)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10663 XDrawLine (dpy, img->mask, gc, 0, 0, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10664 img->width - 1, img->height - 1); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10665 XDrawLine (dpy, img->mask, gc, 0, img->height - 1, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10666 img->width - 1, 0); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10667 XFreeGC (dpy, gc); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10668 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10669 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10670 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10671 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10672 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10673 /* Build a mask for image IMG which is used on frame F. FILE is the |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10674 name of an image file, for error messages. HOW determines how to |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10675 determine the background color of IMG. If it is a list '(R G B)', |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10676 with R, G, and B being integers >= 0, take that as the color of the |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10677 background. Otherwise, determine the background color of IMG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10678 heuristically. Value is non-zero if successful. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10679 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10680 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10681 x_build_heuristic_mask (f, img, how) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10682 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10683 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10684 Lisp_Object how; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10685 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10686 Display *dpy = FRAME_W32_DISPLAY (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10687 XImage *ximg, *mask_img; |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10688 int x, y, rc, use_img_background; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10689 unsigned long bg = 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10690 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10691 if (img->mask) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10692 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10693 XFreePixmap (FRAME_X_DISPLAY (f), img->mask); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10694 img->mask = None; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10695 img->background_transparent_valid = 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10696 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10697 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10698 /* Create an image and pixmap serving as mask. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10699 rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10700 &mask_img, &img->mask); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10701 if (!rc) |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10702 return 0; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10703 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10704 /* Get the X image of IMG->pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10705 ximg = XGetImage (dpy, img->pixmap, 0, 0, img->width, img->height, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10706 ~0, ZPixmap); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10707 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10708 /* Determine the background color of ximg. If HOW is `(R G B)' |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10709 take that as color. Otherwise, use the image's background color. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10710 use_img_background = 1; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10711 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10712 if (CONSP (how)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10713 { |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10714 int rgb[3], i; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10715 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10716 for (i = 0; i < 3 && CONSP (how) && NATNUMP (XCAR (how)); ++i) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10717 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10718 rgb[i] = XFASTINT (XCAR (how)) & 0xffff; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10719 how = XCDR (how); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10720 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10721 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10722 if (i == 3 && NILP (how)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10723 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10724 char color_name[30]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10725 sprintf (color_name, "#%04x%04x%04x", rgb[0], rgb[1], rgb[2]); |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10726 bg = x_alloc_image_color (f, img, build_string (color_name), 0); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10727 use_img_background = 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10728 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10729 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10730 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10731 if (use_img_background) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10732 bg = four_corners_best (ximg, img->width, img->height); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10733 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10734 /* Set all bits in mask_img to 1 whose color in ximg is different |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10735 from the background color bg. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10736 for (y = 0; y < img->height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10737 for (x = 0; x < img->width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10738 XPutPixel (mask_img, x, y, XGetPixel (ximg, x, y) != bg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10739 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10740 /* Fill in the background_transparent field while we have the mask handy. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10741 image_background_transparent (img, f, mask_img); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10742 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10743 /* Put mask_img into img->mask. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10744 x_put_x_image (f, mask_img, img->mask, img->width, img->height); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10745 x_destroy_x_image (mask_img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10746 XDestroyImage (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10747 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10748 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10749 } |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10750 #endif /* TODO */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10751 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10752 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10753 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10754 PBM (mono, gray, color) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10755 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10756 #ifdef HAVE_PBM |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10757 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10758 static int pbm_image_p P_ ((Lisp_Object object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10759 static int pbm_load P_ ((struct frame *f, struct image *img)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10760 static int pbm_scan_number P_ ((unsigned char **, unsigned char *)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10761 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10762 /* The symbol `pbm' identifying images of this type. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10763 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10764 Lisp_Object Qpbm; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10765 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10766 /* Indices of image specification fields in gs_format, below. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10767 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10768 enum pbm_keyword_index |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10769 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10770 PBM_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10771 PBM_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10772 PBM_DATA, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10773 PBM_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10774 PBM_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10775 PBM_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10776 PBM_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10777 PBM_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10778 PBM_MASK, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10779 PBM_FOREGROUND, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10780 PBM_BACKGROUND, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10781 PBM_LAST |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10782 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10783 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10784 /* Vector of image_keyword structures describing the format |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10785 of valid user-defined image specifications. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10786 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10787 static struct image_keyword pbm_format[PBM_LAST] = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10788 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10789 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10790 {":file", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10791 {":data", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10792 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}, |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
10793 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10794 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
10795 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10796 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10797 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10798 {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10799 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10800 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10801 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10802 /* Structure describing the image type `pbm'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10803 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10804 static struct image_type pbm_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10805 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10806 &Qpbm, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10807 pbm_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10808 pbm_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10809 x_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10810 NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10811 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10812 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10813 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10814 /* Return non-zero if OBJECT is a valid PBM image specification. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10815 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10816 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10817 pbm_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10818 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10819 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10820 struct image_keyword fmt[PBM_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10821 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10822 bcopy (pbm_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10823 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10824 if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10825 || (fmt[PBM_ASCENT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10826 && XFASTINT (fmt[PBM_ASCENT].value) > 100)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10827 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10828 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10829 /* Must specify either :data or :file. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10830 return fmt[PBM_DATA].count + fmt[PBM_FILE].count == 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10831 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10832 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10833 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10834 /* Scan a decimal number from *S and return it. Advance *S while |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10835 reading the number. END is the end of the string. Value is -1 at |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10836 end of input. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10837 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10838 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10839 pbm_scan_number (s, end) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10840 unsigned char **s, *end; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10841 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10842 int c, val = -1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10843 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10844 while (*s < end) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10845 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10846 /* Skip white-space. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10847 while (*s < end && (c = *(*s)++, isspace (c))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10848 ; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10849 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10850 if (c == '#') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10851 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10852 /* Skip comment to end of line. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10853 while (*s < end && (c = *(*s)++, c != '\n')) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10854 ; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10855 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10856 else if (isdigit (c)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10857 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10858 /* Read decimal number. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10859 val = c - '0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10860 while (*s < end && (c = *(*s)++, isdigit (c))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10861 val = 10 * val + c - '0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10862 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10863 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10864 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10865 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10866 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10867 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10868 return val; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10869 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10870 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10871 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10872 /* Read FILE into memory. Value is a pointer to a buffer allocated |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10873 with xmalloc holding FILE's contents. Value is null if an error |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10874 occured. *SIZE is set to the size of the file. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10875 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10876 static char * |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10877 pbm_read_file (file, size) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10878 Lisp_Object file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10879 int *size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10880 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10881 FILE *fp = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10882 char *buf = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10883 struct stat st; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10884 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10885 if (stat (XSTRING (file)->data, &st) == 0 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10886 && (fp = fopen (XSTRING (file)->data, "r")) != NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10887 && (buf = (char *) xmalloc (st.st_size), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10888 fread (buf, 1, st.st_size, fp) == st.st_size)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10889 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10890 *size = st.st_size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10891 fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10892 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10893 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10894 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10895 if (fp) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10896 fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10897 if (buf) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10898 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10899 xfree (buf); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10900 buf = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10901 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10902 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10903 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10904 return buf; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10905 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10906 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10907 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10908 /* Load PBM image IMG for use on frame F. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10909 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10910 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10911 pbm_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10912 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10913 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10914 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10915 int raw_p, x, y; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10916 int width, height, max_color_idx = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10917 XImage *ximg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10918 Lisp_Object file, specified_file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10919 enum {PBM_MONO, PBM_GRAY, PBM_COLOR} type; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10920 struct gcpro gcpro1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10921 unsigned char *contents = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10922 unsigned char *end, *p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10923 int size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10924 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10925 specified_file = image_spec_value (img->spec, QCfile, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10926 file = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10927 GCPRO1 (file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10928 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10929 if (STRINGP (specified_file)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10930 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10931 file = x_find_image_file (specified_file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10932 if (!STRINGP (file)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10933 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10934 image_error ("Cannot find image file `%s'", specified_file, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10935 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10936 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10937 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10938 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10939 contents = slurp_file (XSTRING (file)->data, &size); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10940 if (contents == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10941 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10942 image_error ("Error reading `%s'", file, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10943 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10944 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10945 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10946 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10947 p = contents; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10948 end = contents + size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10949 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10950 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10951 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10952 Lisp_Object data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10953 data = image_spec_value (img->spec, QCdata, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10954 p = XSTRING (data)->data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10955 end = p + STRING_BYTES (XSTRING (data)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10956 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10957 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10958 /* Check magic number. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10959 if (end - p < 2 || *p++ != 'P') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10960 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10961 image_error ("Not a PBM image: `%s'", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10962 error: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10963 xfree (contents); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10964 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10965 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10966 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10967 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10968 switch (*p++) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10969 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10970 case '1': |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10971 raw_p = 0, type = PBM_MONO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10972 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10973 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10974 case '2': |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10975 raw_p = 0, type = PBM_GRAY; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10976 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10977 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10978 case '3': |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10979 raw_p = 0, type = PBM_COLOR; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10980 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10981 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10982 case '4': |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10983 raw_p = 1, type = PBM_MONO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10984 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10985 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10986 case '5': |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10987 raw_p = 1, type = PBM_GRAY; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10988 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10989 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10990 case '6': |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10991 raw_p = 1, type = PBM_COLOR; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10992 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10993 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10994 default: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10995 image_error ("Not a PBM image: `%s'", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10996 goto error; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10997 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10998 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10999 /* Read width, height, maximum color-component. Characters |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11000 starting with `#' up to the end of a line are ignored. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11001 width = pbm_scan_number (&p, end); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11002 height = pbm_scan_number (&p, end); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11003 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11004 if (type != PBM_MONO) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11005 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11006 max_color_idx = pbm_scan_number (&p, end); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11007 if (raw_p && max_color_idx > 255) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11008 max_color_idx = 255; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11009 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11010 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11011 if (width < 0 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11012 || height < 0 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11013 || (type != PBM_MONO && max_color_idx < 0)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11014 goto error; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11015 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11016 if (!x_create_x_image_and_pixmap (f, width, height, 0, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11017 &ximg, &img->pixmap)) |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11018 goto error; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11019 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11020 /* Initialize the color hash table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11021 init_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11022 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11023 if (type == PBM_MONO) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11024 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11025 int c = 0, g; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11026 struct image_keyword fmt[PBM_LAST]; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11027 unsigned long fg = FRAME_FOREGROUND_PIXEL (f); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11028 unsigned long bg = FRAME_BACKGROUND_PIXEL (f); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11029 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11030 /* Parse the image specification. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11031 bcopy (pbm_format, fmt, sizeof fmt); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11032 parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11033 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11034 /* Get foreground and background colors, maybe allocate colors. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11035 if (fmt[PBM_FOREGROUND].count |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11036 && STRINGP (fmt[PBM_FOREGROUND].value)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11037 fg = x_alloc_image_color (f, img, fmt[PBM_FOREGROUND].value, fg); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11038 if (fmt[PBM_BACKGROUND].count |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11039 && STRINGP (fmt[PBM_BACKGROUND].value)) |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11040 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11041 bg = x_alloc_image_color (f, img, fmt[PBM_BACKGROUND].value, bg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11042 img->background = bg; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11043 img->background_valid = 1; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11044 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11045 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11046 for (y = 0; y < height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11047 for (x = 0; x < width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11048 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11049 if (raw_p) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11050 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11051 if ((x & 7) == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11052 c = *p++; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11053 g = c & 0x80; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11054 c <<= 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11055 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11056 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11057 g = pbm_scan_number (&p, end); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11058 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11059 XPutPixel (ximg, x, y, g ? fg : bg); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11060 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11061 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11062 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11063 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11064 for (y = 0; y < height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11065 for (x = 0; x < width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11066 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11067 int r, g, b; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11068 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11069 if (type == PBM_GRAY) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11070 r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11071 else if (raw_p) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11072 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11073 r = *p++; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11074 g = *p++; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11075 b = *p++; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11076 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11077 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11078 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11079 r = pbm_scan_number (&p, end); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11080 g = pbm_scan_number (&p, end); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11081 b = pbm_scan_number (&p, end); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11082 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11083 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11084 if (r < 0 || g < 0 || b < 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11085 { |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
11086 xfree (ximg->data); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11087 ximg->data = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11088 XDestroyImage (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11089 image_error ("Invalid pixel value in image `%s'", |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11090 img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11091 goto error; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11092 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11093 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11094 /* RGB values are now in the range 0..max_color_idx. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11095 Scale this to the range 0..0xffff supported by X. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11096 r = (double) r * 65535 / max_color_idx; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11097 g = (double) g * 65535 / max_color_idx; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11098 b = (double) b * 65535 / max_color_idx; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11099 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11100 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11101 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11102 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11103 /* Store in IMG->colors the colors allocated for the image, and |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11104 free the color table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11105 img->colors = colors_in_color_table (&img->ncolors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11106 free_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11107 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11108 /* Maybe fill in the background field while we have ximg handy. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11109 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11110 IMAGE_BACKGROUND (img, f, ximg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11111 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11112 /* Put the image into a pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11113 x_put_x_image (f, ximg, img->pixmap, width, height); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11114 x_destroy_x_image (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11115 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11116 img->width = width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11117 img->height = height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11118 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11119 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11120 xfree (contents); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11121 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11122 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11123 #endif /* HAVE_PBM */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11124 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11125 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11126 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11127 PNG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11128 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11129 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11130 #if HAVE_PNG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11131 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11132 #include <png.h> |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11133 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11134 /* Function prototypes. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11135 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11136 static int png_image_p P_ ((Lisp_Object object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11137 static int png_load P_ ((struct frame *f, struct image *img)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11138 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11139 /* The symbol `png' identifying images of this type. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11140 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11141 Lisp_Object Qpng; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11142 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11143 /* Indices of image specification fields in png_format, below. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11144 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11145 enum png_keyword_index |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11146 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11147 PNG_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11148 PNG_DATA, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11149 PNG_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11150 PNG_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11151 PNG_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11152 PNG_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11153 PNG_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11154 PNG_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11155 PNG_MASK, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11156 PNG_BACKGROUND, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11157 PNG_LAST |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11158 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11159 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11160 /* Vector of image_keyword structures describing the format |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11161 of valid user-defined image specifications. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11162 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11163 static struct image_keyword png_format[PNG_LAST] = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11164 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11165 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11166 {":data", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11167 {":file", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11168 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}, |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
11169 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11170 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
11171 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11172 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11173 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11174 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11175 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11176 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11177 /* Structure describing the image type `png'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11178 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11179 static struct image_type png_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11180 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11181 &Qpng, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11182 png_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11183 png_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11184 x_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11185 NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11186 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11187 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11188 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11189 /* Return non-zero if OBJECT is a valid PNG image specification. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11190 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11191 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11192 png_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11193 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11194 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11195 struct image_keyword fmt[PNG_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11196 bcopy (png_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11197 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11198 if (!parse_image_spec (object, fmt, PNG_LAST, Qpng) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11199 || (fmt[PNG_ASCENT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11200 && XFASTINT (fmt[PNG_ASCENT].value) > 100)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11201 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11202 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11203 /* Must specify either the :data or :file keyword. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11204 return fmt[PNG_FILE].count + fmt[PNG_DATA].count == 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11205 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11206 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11207 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11208 /* Error and warning handlers installed when the PNG library |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11209 is initialized. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11210 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11211 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11212 my_png_error (png_ptr, msg) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11213 png_struct *png_ptr; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11214 char *msg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11215 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11216 xassert (png_ptr != NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11217 image_error ("PNG error: %s", build_string (msg), Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11218 longjmp (png_ptr->jmpbuf, 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11219 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11220 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11221 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11222 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11223 my_png_warning (png_ptr, msg) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11224 png_struct *png_ptr; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11225 char *msg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11226 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11227 xassert (png_ptr != NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11228 image_error ("PNG warning: %s", build_string (msg), Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11229 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11230 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11231 /* Memory source for PNG decoding. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11232 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11233 struct png_memory_storage |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11234 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11235 unsigned char *bytes; /* The data */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11236 size_t len; /* How big is it? */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11237 int index; /* Where are we? */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11238 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11239 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11240 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11241 /* Function set as reader function when reading PNG image from memory. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11242 PNG_PTR is a pointer to the PNG control structure. Copy LENGTH |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11243 bytes from the input to DATA. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11244 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11245 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11246 png_read_from_memory (png_ptr, data, length) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11247 png_structp png_ptr; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11248 png_bytep data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11249 png_size_t length; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11250 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11251 struct png_memory_storage *tbr |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11252 = (struct png_memory_storage *) png_get_io_ptr (png_ptr); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11253 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11254 if (length > tbr->len - tbr->index) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11255 png_error (png_ptr, "Read error"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11256 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11257 bcopy (tbr->bytes + tbr->index, data, length); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11258 tbr->index = tbr->index + length; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11259 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11260 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11261 /* Load PNG image IMG for use on frame F. Value is non-zero if |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11262 successful. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11263 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11264 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11265 png_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11266 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11267 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11268 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11269 Lisp_Object file, specified_file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11270 Lisp_Object specified_data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11271 int x, y, i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11272 XImage *ximg, *mask_img = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11273 struct gcpro gcpro1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11274 png_struct *png_ptr = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11275 png_info *info_ptr = NULL, *end_info = NULL; |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11276 FILE *volatile fp = NULL; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11277 png_byte sig[8]; |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11278 png_byte *volatile pixels = NULL; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11279 png_byte **volatile rows = NULL; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11280 png_uint_32 width, height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11281 int bit_depth, color_type, interlace_type; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11282 png_byte channels; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11283 png_uint_32 row_bytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11284 int transparent_p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11285 char *gamma_str; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11286 double screen_gamma, image_gamma; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11287 int intent; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11288 struct png_memory_storage tbr; /* Data to be read */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11289 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11290 /* Find out what file to load. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11291 specified_file = image_spec_value (img->spec, QCfile, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11292 specified_data = image_spec_value (img->spec, QCdata, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11293 file = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11294 GCPRO1 (file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11295 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11296 if (NILP (specified_data)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11297 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11298 file = x_find_image_file (specified_file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11299 if (!STRINGP (file)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11300 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11301 image_error ("Cannot find image file `%s'", specified_file, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11302 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11303 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11304 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11305 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11306 /* Open the image file. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11307 fp = fopen (XSTRING (file)->data, "rb"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11308 if (!fp) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11309 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11310 image_error ("Cannot open image file `%s'", file, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11311 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11312 fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11313 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11314 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11315 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11316 /* Check PNG signature. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11317 if (fread (sig, 1, sizeof sig, fp) != sizeof sig |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11318 || !png_check_sig (sig, sizeof sig)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11319 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11320 image_error ("Not a PNG file:` %s'", file, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11321 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11322 fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11323 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11324 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11325 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11326 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11327 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11328 /* Read from memory. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11329 tbr.bytes = XSTRING (specified_data)->data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11330 tbr.len = STRING_BYTES (XSTRING (specified_data)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11331 tbr.index = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11332 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11333 /* Check PNG signature. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11334 if (tbr.len < sizeof sig |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11335 || !png_check_sig (tbr.bytes, sizeof sig)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11336 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11337 image_error ("Not a PNG image: `%s'", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11338 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11339 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11340 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11341 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11342 /* Need to skip past the signature. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11343 tbr.bytes += sizeof (sig); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11344 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11345 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11346 /* Initialize read and info structs for PNG lib. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11347 png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11348 my_png_error, my_png_warning); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11349 if (!png_ptr) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11350 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11351 if (fp) fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11352 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11353 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11354 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11355 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11356 info_ptr = png_create_info_struct (png_ptr); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11357 if (!info_ptr) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11358 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11359 png_destroy_read_struct (&png_ptr, NULL, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11360 if (fp) fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11361 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11362 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11363 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11364 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11365 end_info = png_create_info_struct (png_ptr); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11366 if (!end_info) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11367 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11368 png_destroy_read_struct (&png_ptr, &info_ptr, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11369 if (fp) fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11370 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11371 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11372 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11373 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11374 /* Set error jump-back. We come back here when the PNG library |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11375 detects an error. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11376 if (setjmp (png_ptr->jmpbuf)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11377 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11378 error: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11379 if (png_ptr) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11380 png_destroy_read_struct (&png_ptr, &info_ptr, &end_info); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11381 xfree (pixels); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11382 xfree (rows); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11383 if (fp) fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11384 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11385 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11386 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11387 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11388 /* Read image info. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11389 if (!NILP (specified_data)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11390 png_set_read_fn (png_ptr, (void *) &tbr, png_read_from_memory); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11391 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11392 png_init_io (png_ptr, fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11393 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11394 png_set_sig_bytes (png_ptr, sizeof sig); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11395 png_read_info (png_ptr, info_ptr); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11396 png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11397 &interlace_type, NULL, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11398 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11399 /* If image contains simply transparency data, we prefer to |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11400 construct a clipping mask. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11401 if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11402 transparent_p = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11403 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11404 transparent_p = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11405 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11406 /* This function is easier to write if we only have to handle |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11407 one data format: RGB or RGBA with 8 bits per channel. Let's |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11408 transform other formats into that format. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11409 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11410 /* Strip more than 8 bits per channel. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11411 if (bit_depth == 16) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11412 png_set_strip_16 (png_ptr); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11413 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11414 /* Expand data to 24 bit RGB, or 8 bit grayscale, with alpha channel |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11415 if available. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11416 png_set_expand (png_ptr); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11417 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11418 /* Convert grayscale images to RGB. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11419 if (color_type == PNG_COLOR_TYPE_GRAY |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11420 || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11421 png_set_gray_to_rgb (png_ptr); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11422 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11423 /* The value 2.2 is a guess for PC monitors from PNG example.c. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11424 gamma_str = getenv ("SCREEN_GAMMA"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11425 screen_gamma = gamma_str ? atof (gamma_str) : 2.2; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11426 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11427 /* Tell the PNG lib to handle gamma correction for us. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11428 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11429 #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11430 if (png_get_sRGB (png_ptr, info_ptr, &intent)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11431 /* There is a special chunk in the image specifying the gamma. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11432 png_set_sRGB (png_ptr, info_ptr, intent); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11433 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11434 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11435 if (png_get_gAMA (png_ptr, info_ptr, &image_gamma)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11436 /* Image contains gamma information. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11437 png_set_gamma (png_ptr, screen_gamma, image_gamma); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11438 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11439 /* Use a default of 0.5 for the image gamma. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11440 png_set_gamma (png_ptr, screen_gamma, 0.5); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11441 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11442 /* Handle alpha channel by combining the image with a background |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11443 color. Do this only if a real alpha channel is supplied. For |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11444 simple transparency, we prefer a clipping mask. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11445 if (!transparent_p) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11446 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11447 png_color_16 *image_background; |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11448 Lisp_Object specified_bg |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11449 = image_spec_value (img->spec, QCbackground, NULL); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11450 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11451 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11452 if (STRINGP (specified_bg)) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11453 /* The user specified `:background', use that. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11454 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11455 COLORREF color; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11456 if (w32_defined_color (f, XSTRING (specified_bg)->data, &color, 0)) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11457 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11458 png_color_16 user_bg; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11459 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11460 bzero (&user_bg, sizeof user_bg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11461 user_bg.red = color.red; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11462 user_bg.green = color.green; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11463 user_bg.blue = color.blue; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11464 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11465 png_set_background (png_ptr, &user_bg, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11466 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11467 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11468 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11469 else if (png_get_bKGD (png_ptr, info_ptr, &image_background)) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11470 /* Image contains a background color with which to |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11471 combine the image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11472 png_set_background (png_ptr, image_background, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11473 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11474 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11475 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11476 /* Image does not contain a background color with which |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11477 to combine the image data via an alpha channel. Use |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11478 the frame's background instead. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11479 XColor color; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11480 Colormap cmap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11481 png_color_16 frame_background; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11482 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11483 cmap = FRAME_X_COLORMAP (f); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11484 color.pixel = FRAME_BACKGROUND_PIXEL (f); |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11485 x_query_color (f, &color); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11486 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11487 bzero (&frame_background, sizeof frame_background); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11488 frame_background.red = color.red; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11489 frame_background.green = color.green; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11490 frame_background.blue = color.blue; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11491 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11492 png_set_background (png_ptr, &frame_background, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11493 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11494 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11495 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11496 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11497 /* Update info structure. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11498 png_read_update_info (png_ptr, info_ptr); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11499 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11500 /* Get number of channels. Valid values are 1 for grayscale images |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11501 and images with a palette, 2 for grayscale images with transparency |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11502 information (alpha channel), 3 for RGB images, and 4 for RGB |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11503 images with alpha channel, i.e. RGBA. If conversions above were |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11504 sufficient we should only have 3 or 4 channels here. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11505 channels = png_get_channels (png_ptr, info_ptr); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11506 xassert (channels == 3 || channels == 4); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11507 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11508 /* Number of bytes needed for one row of the image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11509 row_bytes = png_get_rowbytes (png_ptr, info_ptr); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11510 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11511 /* Allocate memory for the image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11512 pixels = (png_byte *) xmalloc (row_bytes * height * sizeof *pixels); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11513 rows = (png_byte **) xmalloc (height * sizeof *rows); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11514 for (i = 0; i < height; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11515 rows[i] = pixels + i * row_bytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11516 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11517 /* Read the entire image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11518 png_read_image (png_ptr, rows); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11519 png_read_end (png_ptr, info_ptr); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11520 if (fp) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11521 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11522 fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11523 fp = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11524 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11525 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11526 /* Create the X image and pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11527 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11528 &img->pixmap)) |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11529 goto error; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11530 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11531 /* Create an image and pixmap serving as mask if the PNG image |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11532 contains an alpha channel. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11533 if (channels == 4 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11534 && !transparent_p |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11535 && !x_create_x_image_and_pixmap (f, width, height, 1, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11536 &mask_img, &img->mask)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11537 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11538 x_destroy_x_image (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11539 XFreePixmap (FRAME_W32_DISPLAY (f), img->pixmap); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11540 img->pixmap = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11541 goto error; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11542 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11543 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11544 /* Fill the X image and mask from PNG data. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11545 init_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11546 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11547 for (y = 0; y < height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11548 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11549 png_byte *p = rows[y]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11550 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11551 for (x = 0; x < width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11552 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11553 unsigned r, g, b; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11554 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11555 r = *p++ << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11556 g = *p++ << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11557 b = *p++ << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11558 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11559 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11560 /* An alpha channel, aka mask channel, associates variable |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11561 transparency with an image. Where other image formats |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11562 support binary transparency---fully transparent or fully |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11563 opaque---PNG allows up to 254 levels of partial transparency. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11564 The PNG library implements partial transparency by combining |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11565 the image with a specified background color. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11566 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11567 I'm not sure how to handle this here nicely: because the |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11568 background on which the image is displayed may change, for |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11569 real alpha channel support, it would be necessary to create |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11570 a new image for each possible background. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11571 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11572 What I'm doing now is that a mask is created if we have |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11573 boolean transparency information. Otherwise I'm using |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11574 the frame's background color to combine the image with. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11575 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11576 if (channels == 4) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11577 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11578 if (mask_img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11579 XPutPixel (mask_img, x, y, *p > 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11580 ++p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11581 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11582 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11583 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11584 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11585 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11586 /* Set IMG's background color from the PNG image, unless the user |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11587 overrode it. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11588 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11589 png_color_16 *bg; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11590 if (png_get_bKGD (png_ptr, info_ptr, &bg)) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11591 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11592 img->background = lookup_rgb_color (f, bg->red, bg->green, bg->blue); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11593 img->background_valid = 1; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11594 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11595 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11596 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11597 /* Remember colors allocated for this image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11598 img->colors = colors_in_color_table (&img->ncolors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11599 free_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11600 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11601 /* Clean up. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11602 png_destroy_read_struct (&png_ptr, &info_ptr, &end_info); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11603 xfree (rows); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11604 xfree (pixels); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11605 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11606 img->width = width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11607 img->height = height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11608 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11609 /* Maybe fill in the background field while we have ximg handy. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11610 IMAGE_BACKGROUND (img, f, ximg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11611 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11612 /* Put the image into the pixmap, then free the X image and its buffer. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11613 x_put_x_image (f, ximg, img->pixmap, width, height); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11614 x_destroy_x_image (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11615 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11616 /* Same for the mask. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11617 if (mask_img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11618 { |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11619 /* Fill in the background_transparent field while we have the mask |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11620 handy. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11621 image_background_transparent (img, f, mask_img); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11622 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11623 x_put_x_image (f, mask_img, img->mask, img->width, img->height); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11624 x_destroy_x_image (mask_img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11625 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11626 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11627 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11628 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11629 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11630 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11631 #endif /* HAVE_PNG != 0 */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11632 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11633 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11634 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11635 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11636 JPEG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11637 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11638 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11639 #if HAVE_JPEG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11640 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11641 /* Work around a warning about HAVE_STDLIB_H being redefined in |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11642 jconfig.h. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11643 #ifdef HAVE_STDLIB_H |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11644 #define HAVE_STDLIB_H_1 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11645 #undef HAVE_STDLIB_H |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11646 #endif /* HAVE_STLIB_H */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11647 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11648 #include <jpeglib.h> |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11649 #include <jerror.h> |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11650 #include <setjmp.h> |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11651 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11652 #ifdef HAVE_STLIB_H_1 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11653 #define HAVE_STDLIB_H 1 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11654 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11655 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11656 static int jpeg_image_p P_ ((Lisp_Object object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11657 static int jpeg_load P_ ((struct frame *f, struct image *img)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11658 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11659 /* The symbol `jpeg' identifying images of this type. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11660 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11661 Lisp_Object Qjpeg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11662 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11663 /* Indices of image specification fields in gs_format, below. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11664 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11665 enum jpeg_keyword_index |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11666 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11667 JPEG_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11668 JPEG_DATA, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11669 JPEG_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11670 JPEG_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11671 JPEG_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11672 JPEG_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11673 JPEG_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11674 JPEG_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11675 JPEG_MASK, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11676 JPEG_BACKGROUND, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11677 JPEG_LAST |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11678 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11679 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11680 /* Vector of image_keyword structures describing the format |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11681 of valid user-defined image specifications. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11682 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11683 static struct image_keyword jpeg_format[JPEG_LAST] = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11684 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11685 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11686 {":data", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11687 {":file", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11688 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}, |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
11689 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11690 {":relief", IMAGE_INTEGER_VALUE, 0}, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11691 {":conversions", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11692 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11693 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11694 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11695 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11696 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11697 /* Structure describing the image type `jpeg'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11698 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11699 static struct image_type jpeg_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11700 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11701 &Qjpeg, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11702 jpeg_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11703 jpeg_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11704 x_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11705 NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11706 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11707 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11708 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11709 /* Return non-zero if OBJECT is a valid JPEG image specification. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11710 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11711 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11712 jpeg_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11713 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11714 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11715 struct image_keyword fmt[JPEG_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11716 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11717 bcopy (jpeg_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11718 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11719 if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11720 || (fmt[JPEG_ASCENT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11721 && XFASTINT (fmt[JPEG_ASCENT].value) > 100)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11722 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11723 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11724 /* Must specify either the :data or :file keyword. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11725 return fmt[JPEG_FILE].count + fmt[JPEG_DATA].count == 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11726 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11727 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11728 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11729 struct my_jpeg_error_mgr |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11730 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11731 struct jpeg_error_mgr pub; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11732 jmp_buf setjmp_buffer; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11733 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11734 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11735 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11736 my_error_exit (cinfo) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11737 j_common_ptr cinfo; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11738 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11739 struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11740 longjmp (mgr->setjmp_buffer, 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11741 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11742 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11743 /* Init source method for JPEG data source manager. Called by |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11744 jpeg_read_header() before any data is actually read. See |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11745 libjpeg.doc from the JPEG lib distribution. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11746 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11747 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11748 our_init_source (cinfo) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11749 j_decompress_ptr cinfo; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11750 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11751 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11752 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11753 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11754 /* Fill input buffer method for JPEG data source manager. Called |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11755 whenever more data is needed. We read the whole image in one step, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11756 so this only adds a fake end of input marker at the end. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11757 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11758 static boolean |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11759 our_fill_input_buffer (cinfo) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11760 j_decompress_ptr cinfo; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11761 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11762 /* Insert a fake EOI marker. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11763 struct jpeg_source_mgr *src = cinfo->src; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11764 static JOCTET buffer[2]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11765 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11766 buffer[0] = (JOCTET) 0xFF; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11767 buffer[1] = (JOCTET) JPEG_EOI; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11768 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11769 src->next_input_byte = buffer; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11770 src->bytes_in_buffer = 2; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11771 return TRUE; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11772 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11773 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11774 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11775 /* Method to skip over NUM_BYTES bytes in the image data. CINFO->src |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11776 is the JPEG data source manager. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11777 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11778 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11779 our_skip_input_data (cinfo, num_bytes) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11780 j_decompress_ptr cinfo; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11781 long num_bytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11782 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11783 struct jpeg_source_mgr *src = (struct jpeg_source_mgr *) cinfo->src; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11784 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11785 if (src) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11786 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11787 if (num_bytes > src->bytes_in_buffer) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11788 ERREXIT (cinfo, JERR_INPUT_EOF); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11789 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11790 src->bytes_in_buffer -= num_bytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11791 src->next_input_byte += num_bytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11792 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11793 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11794 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11795 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11796 /* Method to terminate data source. Called by |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11797 jpeg_finish_decompress() after all data has been processed. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11798 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11799 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11800 our_term_source (cinfo) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11801 j_decompress_ptr cinfo; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11802 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11803 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11804 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11805 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11806 /* Set up the JPEG lib for reading an image from DATA which contains |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11807 LEN bytes. CINFO is the decompression info structure created for |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11808 reading the image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11809 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11810 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11811 jpeg_memory_src (cinfo, data, len) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11812 j_decompress_ptr cinfo; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11813 JOCTET *data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11814 unsigned int len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11815 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11816 struct jpeg_source_mgr *src; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11817 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11818 if (cinfo->src == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11819 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11820 /* First time for this JPEG object? */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11821 cinfo->src = (struct jpeg_source_mgr *) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11822 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11823 sizeof (struct jpeg_source_mgr)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11824 src = (struct jpeg_source_mgr *) cinfo->src; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11825 src->next_input_byte = data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11826 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11827 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11828 src = (struct jpeg_source_mgr *) cinfo->src; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11829 src->init_source = our_init_source; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11830 src->fill_input_buffer = our_fill_input_buffer; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11831 src->skip_input_data = our_skip_input_data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11832 src->resync_to_restart = jpeg_resync_to_restart; /* Use default method. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11833 src->term_source = our_term_source; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11834 src->bytes_in_buffer = len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11835 src->next_input_byte = data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11836 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11837 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11838 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11839 /* Load image IMG for use on frame F. Patterned after example.c |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11840 from the JPEG lib. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11841 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11842 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11843 jpeg_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11844 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11845 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11846 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11847 struct jpeg_decompress_struct cinfo; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11848 struct my_jpeg_error_mgr mgr; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11849 Lisp_Object file, specified_file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11850 Lisp_Object specified_data; |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11851 FILE * volatile fp = NULL; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11852 JSAMPARRAY buffer; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11853 int row_stride, x, y; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11854 XImage *ximg = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11855 int rc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11856 unsigned long *colors; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11857 int width, height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11858 struct gcpro gcpro1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11859 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11860 /* Open the JPEG file. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11861 specified_file = image_spec_value (img->spec, QCfile, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11862 specified_data = image_spec_value (img->spec, QCdata, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11863 file = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11864 GCPRO1 (file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11865 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11866 if (NILP (specified_data)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11867 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11868 file = x_find_image_file (specified_file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11869 if (!STRINGP (file)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11870 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11871 image_error ("Cannot find image file `%s'", specified_file, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11872 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11873 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11874 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11875 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11876 fp = fopen (XSTRING (file)->data, "r"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11877 if (fp == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11878 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11879 image_error ("Cannot open `%s'", file, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11880 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11881 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11882 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11883 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11884 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11885 /* Customize libjpeg's error handling to call my_error_exit when an |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11886 error is detected. This function will perform a longjmp. */ |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11887 cinfo.err = jpeg_std_error (&mgr.pub); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11888 mgr.pub.error_exit = my_error_exit; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11889 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11890 if ((rc = setjmp (mgr.setjmp_buffer)) != 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11891 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11892 if (rc == 1) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11893 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11894 /* Called from my_error_exit. Display a JPEG error. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11895 char buffer[JMSG_LENGTH_MAX]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11896 cinfo.err->format_message ((j_common_ptr) &cinfo, buffer); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11897 image_error ("Error reading JPEG image `%s': %s", img->spec, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11898 build_string (buffer)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11899 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11900 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11901 /* Close the input file and destroy the JPEG object. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11902 if (fp) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11903 fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11904 jpeg_destroy_decompress (&cinfo); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11905 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11906 /* If we already have an XImage, free that. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11907 x_destroy_x_image (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11908 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11909 /* Free pixmap and colors. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11910 x_clear_image (f, img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11911 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11912 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11913 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11914 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11915 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11916 /* Create the JPEG decompression object. Let it read from fp. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11917 Read the JPEG image header. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11918 jpeg_create_decompress (&cinfo); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11919 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11920 if (NILP (specified_data)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11921 jpeg_stdio_src (&cinfo, fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11922 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11923 jpeg_memory_src (&cinfo, XSTRING (specified_data)->data, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11924 STRING_BYTES (XSTRING (specified_data))); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11925 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11926 jpeg_read_header (&cinfo, TRUE); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11927 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11928 /* Customize decompression so that color quantization will be used. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11929 Start decompression. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11930 cinfo.quantize_colors = TRUE; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11931 jpeg_start_decompress (&cinfo); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11932 width = img->width = cinfo.output_width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11933 height = img->height = cinfo.output_height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11934 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11935 /* Create X image and pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11936 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11937 &img->pixmap)) |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11938 longjmp (mgr.setjmp_buffer, 2); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11939 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11940 /* Allocate colors. When color quantization is used, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11941 cinfo.actual_number_of_colors has been set with the number of |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11942 colors generated, and cinfo.colormap is a two-dimensional array |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11943 of color indices in the range 0..cinfo.actual_number_of_colors. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11944 No more than 255 colors will be generated. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11945 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11946 int i, ir, ig, ib; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11947 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11948 if (cinfo.out_color_components > 2) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11949 ir = 0, ig = 1, ib = 2; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11950 else if (cinfo.out_color_components > 1) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11951 ir = 0, ig = 1, ib = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11952 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11953 ir = 0, ig = 0, ib = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11954 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11955 /* Use the color table mechanism because it handles colors that |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11956 cannot be allocated nicely. Such colors will be replaced with |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11957 a default color, and we don't have to care about which colors |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11958 can be freed safely, and which can't. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11959 init_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11960 colors = (unsigned long *) alloca (cinfo.actual_number_of_colors |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11961 * sizeof *colors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11962 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11963 for (i = 0; i < cinfo.actual_number_of_colors; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11964 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11965 /* Multiply RGB values with 255 because X expects RGB values |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11966 in the range 0..0xffff. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11967 int r = cinfo.colormap[ir][i] << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11968 int g = cinfo.colormap[ig][i] << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11969 int b = cinfo.colormap[ib][i] << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11970 colors[i] = lookup_rgb_color (f, r, g, b); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11971 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11972 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11973 /* Remember those colors actually allocated. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11974 img->colors = colors_in_color_table (&img->ncolors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11975 free_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11976 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11977 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11978 /* Read pixels. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11979 row_stride = width * cinfo.output_components; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11980 buffer = cinfo.mem->alloc_sarray ((j_common_ptr) &cinfo, JPOOL_IMAGE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11981 row_stride, 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11982 for (y = 0; y < height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11983 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11984 jpeg_read_scanlines (&cinfo, buffer, 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11985 for (x = 0; x < cinfo.output_width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11986 XPutPixel (ximg, x, y, colors[buffer[0][x]]); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11987 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11988 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11989 /* Clean up. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11990 jpeg_finish_decompress (&cinfo); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11991 jpeg_destroy_decompress (&cinfo); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11992 if (fp) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11993 fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11994 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11995 /* Maybe fill in the background field while we have ximg handy. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11996 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11997 IMAGE_BACKGROUND (img, f, ximg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11998 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11999 /* Put the image into the pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12000 x_put_x_image (f, ximg, img->pixmap, width, height); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12001 x_destroy_x_image (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12002 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12003 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12004 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12005 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12006 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12007 #endif /* HAVE_JPEG */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12008 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12009 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12010 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12011 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12012 TIFF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12013 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12014 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12015 #if HAVE_TIFF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12016 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12017 #include <tiffio.h> |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12018 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12019 static int tiff_image_p P_ ((Lisp_Object object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12020 static int tiff_load P_ ((struct frame *f, struct image *img)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12021 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12022 /* The symbol `tiff' identifying images of this type. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12023 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12024 Lisp_Object Qtiff; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12025 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12026 /* Indices of image specification fields in tiff_format, below. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12027 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12028 enum tiff_keyword_index |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12029 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12030 TIFF_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12031 TIFF_DATA, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12032 TIFF_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12033 TIFF_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12034 TIFF_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12035 TIFF_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12036 TIFF_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12037 TIFF_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12038 TIFF_MASK, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12039 TIFF_BACKGROUND, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12040 TIFF_LAST |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12041 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12042 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12043 /* Vector of image_keyword structures describing the format |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12044 of valid user-defined image specifications. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12045 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12046 static struct image_keyword tiff_format[TIFF_LAST] = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12047 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12048 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12049 {":data", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12050 {":file", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12051 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}, |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
12052 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12053 {":relief", IMAGE_INTEGER_VALUE, 0}, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12054 {":conversions", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12055 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12056 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12057 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12058 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12059 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12060 /* Structure describing the image type `tiff'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12061 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12062 static struct image_type tiff_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12063 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12064 &Qtiff, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12065 tiff_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12066 tiff_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12067 x_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12068 NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12069 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12070 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12071 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12072 /* Return non-zero if OBJECT is a valid TIFF image specification. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12073 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12074 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12075 tiff_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12076 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12077 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12078 struct image_keyword fmt[TIFF_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12079 bcopy (tiff_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12080 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12081 if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12082 || (fmt[TIFF_ASCENT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12083 && XFASTINT (fmt[TIFF_ASCENT].value) > 100)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12084 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12085 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12086 /* Must specify either the :data or :file keyword. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12087 return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12088 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12089 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12090 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12091 /* Reading from a memory buffer for TIFF images Based on the PNG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12092 memory source, but we have to provide a lot of extra functions. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12093 Blah. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12094 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12095 We really only need to implement read and seek, but I am not |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12096 convinced that the TIFF library is smart enough not to destroy |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12097 itself if we only hand it the function pointers we need to |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12098 override. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12099 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12100 typedef struct |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12101 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12102 unsigned char *bytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12103 size_t len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12104 int index; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12105 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12106 tiff_memory_source; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12107 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12108 static size_t |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12109 tiff_read_from_memory (data, buf, size) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12110 thandle_t data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12111 tdata_t buf; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12112 tsize_t size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12113 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12114 tiff_memory_source *src = (tiff_memory_source *) data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12115 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12116 if (size > src->len - src->index) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12117 return (size_t) -1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12118 bcopy (src->bytes + src->index, buf, size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12119 src->index += size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12120 return size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12121 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12122 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12123 static size_t |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12124 tiff_write_from_memory (data, buf, size) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12125 thandle_t data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12126 tdata_t buf; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12127 tsize_t size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12128 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12129 return (size_t) -1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12130 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12131 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12132 static toff_t |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12133 tiff_seek_in_memory (data, off, whence) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12134 thandle_t data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12135 toff_t off; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12136 int whence; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12137 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12138 tiff_memory_source *src = (tiff_memory_source *) data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12139 int idx; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12140 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12141 switch (whence) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12142 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12143 case SEEK_SET: /* Go from beginning of source. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12144 idx = off; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12145 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12146 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12147 case SEEK_END: /* Go from end of source. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12148 idx = src->len + off; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12149 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12150 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12151 case SEEK_CUR: /* Go from current position. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12152 idx = src->index + off; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12153 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12154 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12155 default: /* Invalid `whence'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12156 return -1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12157 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12158 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12159 if (idx > src->len || idx < 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12160 return -1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12161 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12162 src->index = idx; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12163 return src->index; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12164 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12165 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12166 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12167 tiff_close_memory (data) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12168 thandle_t data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12169 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12170 /* NOOP */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12171 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12172 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12173 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12174 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12175 tiff_mmap_memory (data, pbase, psize) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12176 thandle_t data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12177 tdata_t *pbase; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12178 toff_t *psize; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12179 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12180 /* It is already _IN_ memory. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12181 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12182 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12183 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12184 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12185 tiff_unmap_memory (data, base, size) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12186 thandle_t data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12187 tdata_t base; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12188 toff_t size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12189 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12190 /* We don't need to do this. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12191 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12192 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12193 static toff_t |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12194 tiff_size_of_memory (data) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12195 thandle_t data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12196 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12197 return ((tiff_memory_source *) data)->len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12198 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12199 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12200 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12201 static void |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12202 tiff_error_handler (title, format, ap) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12203 const char *title, *format; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12204 va_list ap; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12205 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12206 char buf[512]; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12207 int len; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12208 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12209 len = sprintf (buf, "TIFF error: %s ", title); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12210 vsprintf (buf + len, format, ap); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12211 add_to_log (buf, Qnil, Qnil); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12212 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12213 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12214 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12215 static void |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12216 tiff_warning_handler (title, format, ap) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12217 const char *title, *format; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12218 va_list ap; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12219 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12220 char buf[512]; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12221 int len; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12222 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12223 len = sprintf (buf, "TIFF warning: %s ", title); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12224 vsprintf (buf + len, format, ap); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12225 add_to_log (buf, Qnil, Qnil); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12226 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12227 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12228 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12229 /* Load TIFF image IMG for use on frame F. Value is non-zero if |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12230 successful. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12231 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12232 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12233 tiff_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12234 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12235 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12236 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12237 Lisp_Object file, specified_file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12238 Lisp_Object specified_data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12239 TIFF *tiff; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12240 int width, height, x, y; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12241 uint32 *buf; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12242 int rc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12243 XImage *ximg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12244 struct gcpro gcpro1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12245 tiff_memory_source memsrc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12246 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12247 specified_file = image_spec_value (img->spec, QCfile, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12248 specified_data = image_spec_value (img->spec, QCdata, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12249 file = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12250 GCPRO1 (file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12251 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12252 TIFFSetErrorHandler (tiff_error_handler); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12253 TIFFSetWarningHandler (tiff_warning_handler); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12254 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12255 if (NILP (specified_data)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12256 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12257 /* Read from a file */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12258 file = x_find_image_file (specified_file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12259 if (!STRINGP (file)) |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12260 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12261 image_error ("Cannot find image file `%s'", file, Qnil); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12262 UNGCPRO; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12263 return 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12264 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12265 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12266 /* Try to open the image file. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12267 tiff = TIFFOpen (XSTRING (file)->data, "r"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12268 if (tiff == NULL) |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12269 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12270 image_error ("Cannot open `%s'", file, Qnil); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12271 UNGCPRO; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12272 return 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12273 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12274 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12275 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12276 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12277 /* Memory source! */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12278 memsrc.bytes = XSTRING (specified_data)->data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12279 memsrc.len = STRING_BYTES (XSTRING (specified_data)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12280 memsrc.index = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12281 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12282 tiff = TIFFClientOpen ("memory_source", "r", &memsrc, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12283 (TIFFReadWriteProc) tiff_read_from_memory, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12284 (TIFFReadWriteProc) tiff_write_from_memory, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12285 tiff_seek_in_memory, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12286 tiff_close_memory, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12287 tiff_size_of_memory, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12288 tiff_mmap_memory, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12289 tiff_unmap_memory); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12290 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12291 if (!tiff) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12292 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12293 image_error ("Cannot open memory source for `%s'", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12294 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12295 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12296 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12297 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12298 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12299 /* Get width and height of the image, and allocate a raster buffer |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12300 of width x height 32-bit values. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12301 TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12302 TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12303 buf = (uint32 *) xmalloc (width * height * sizeof *buf); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12304 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12305 rc = TIFFReadRGBAImage (tiff, width, height, buf, 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12306 TIFFClose (tiff); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12307 if (!rc) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12308 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12309 image_error ("Error reading TIFF image `%s'", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12310 xfree (buf); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12311 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12312 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12313 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12314 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12315 /* Create the X image and pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12316 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12317 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12318 xfree (buf); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12319 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12320 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12321 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12322 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12323 /* Initialize the color table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12324 init_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12325 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12326 /* Process the pixel raster. Origin is in the lower-left corner. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12327 for (y = 0; y < height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12328 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12329 uint32 *row = buf + y * width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12330 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12331 for (x = 0; x < width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12332 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12333 uint32 abgr = row[x]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12334 int r = TIFFGetR (abgr) << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12335 int g = TIFFGetG (abgr) << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12336 int b = TIFFGetB (abgr) << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12337 XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12338 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12339 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12340 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12341 /* Remember the colors allocated for the image. Free the color table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12342 img->colors = colors_in_color_table (&img->ncolors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12343 free_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12344 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12345 img->width = width; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12346 img->height = height; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12347 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12348 /* Maybe fill in the background field while we have ximg handy. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12349 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12350 IMAGE_BACKGROUND (img, f, ximg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12351 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12352 /* Put the image into the pixmap, then free the X image and its buffer. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12353 x_put_x_image (f, ximg, img->pixmap, width, height); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12354 x_destroy_x_image (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12355 xfree (buf); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12356 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12357 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12358 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12359 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12360 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12361 #endif /* HAVE_TIFF != 0 */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12362 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12363 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12364 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12365 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12366 GIF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12367 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12368 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12369 #if HAVE_GIF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12370 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12371 #include <gif_lib.h> |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12372 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12373 static int gif_image_p P_ ((Lisp_Object object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12374 static int gif_load P_ ((struct frame *f, struct image *img)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12375 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12376 /* The symbol `gif' identifying images of this type. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12377 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12378 Lisp_Object Qgif; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12379 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12380 /* Indices of image specification fields in gif_format, below. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12381 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12382 enum gif_keyword_index |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12383 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12384 GIF_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12385 GIF_DATA, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12386 GIF_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12387 GIF_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12388 GIF_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12389 GIF_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12390 GIF_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12391 GIF_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12392 GIF_MASK, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12393 GIF_IMAGE, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12394 GIF_BACKGROUND, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12395 GIF_LAST |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12396 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12397 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12398 /* Vector of image_keyword structures describing the format |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12399 of valid user-defined image specifications. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12400 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12401 static struct image_keyword gif_format[GIF_LAST] = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12402 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12403 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12404 {":data", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12405 {":file", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12406 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}, |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
12407 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12408 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
12409 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12410 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12411 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12412 {":image", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12413 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12414 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12415 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12416 /* Structure describing the image type `gif'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12417 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12418 static struct image_type gif_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12419 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12420 &Qgif, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12421 gif_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12422 gif_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12423 x_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12424 NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12425 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12426 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12427 /* Return non-zero if OBJECT is a valid GIF image specification. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12428 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12429 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12430 gif_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12431 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12432 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12433 struct image_keyword fmt[GIF_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12434 bcopy (gif_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12435 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12436 if (!parse_image_spec (object, fmt, GIF_LAST, Qgif) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12437 || (fmt[GIF_ASCENT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12438 && XFASTINT (fmt[GIF_ASCENT].value) > 100)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12439 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12440 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12441 /* Must specify either the :data or :file keyword. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12442 return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12443 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12444 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12445 /* Reading a GIF image from memory |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12446 Based on the PNG memory stuff to a certain extent. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12447 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12448 typedef struct |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12449 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12450 unsigned char *bytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12451 size_t len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12452 int index; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12453 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12454 gif_memory_source; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12455 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12456 /* Make the current memory source available to gif_read_from_memory. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12457 It's done this way because not all versions of libungif support |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12458 a UserData field in the GifFileType structure. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12459 static gif_memory_source *current_gif_memory_src; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12460 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12461 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12462 gif_read_from_memory (file, buf, len) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12463 GifFileType *file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12464 GifByteType *buf; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12465 int len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12466 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12467 gif_memory_source *src = current_gif_memory_src; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12468 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12469 if (len > src->len - src->index) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12470 return -1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12471 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12472 bcopy (src->bytes + src->index, buf, len); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12473 src->index += len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12474 return len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12475 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12476 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12477 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12478 /* Load GIF image IMG for use on frame F. Value is non-zero if |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12479 successful. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12480 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12481 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12482 gif_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12483 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12484 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12485 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12486 Lisp_Object file, specified_file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12487 Lisp_Object specified_data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12488 int rc, width, height, x, y, i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12489 XImage *ximg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12490 ColorMapObject *gif_color_map; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12491 unsigned long pixel_colors[256]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12492 GifFileType *gif; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12493 struct gcpro gcpro1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12494 Lisp_Object image; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12495 int ino, image_left, image_top, image_width, image_height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12496 gif_memory_source memsrc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12497 unsigned char *raster; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12498 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12499 specified_file = image_spec_value (img->spec, QCfile, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12500 specified_data = image_spec_value (img->spec, QCdata, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12501 file = Qnil; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
12502 GCPRO1 (file); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12503 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12504 if (NILP (specified_data)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12505 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12506 file = x_find_image_file (specified_file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12507 if (!STRINGP (file)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12508 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12509 image_error ("Cannot find image file `%s'", specified_file, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12510 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12511 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12512 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12513 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12514 /* Open the GIF file. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12515 gif = DGifOpenFileName (XSTRING (file)->data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12516 if (gif == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12517 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12518 image_error ("Cannot open `%s'", file, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12519 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12520 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12521 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12522 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12523 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12524 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12525 /* Read from memory! */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12526 current_gif_memory_src = &memsrc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12527 memsrc.bytes = XSTRING (specified_data)->data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12528 memsrc.len = STRING_BYTES (XSTRING (specified_data)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12529 memsrc.index = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12530 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12531 gif = DGifOpen(&memsrc, gif_read_from_memory); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12532 if (!gif) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12533 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12534 image_error ("Cannot open memory source `%s'", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12535 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12536 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12537 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12538 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12539 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12540 /* Read entire contents. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12541 rc = DGifSlurp (gif); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12542 if (rc == GIF_ERROR) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12543 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12544 image_error ("Error reading `%s'", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12545 DGifCloseFile (gif); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12546 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12547 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12548 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12549 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12550 image = image_spec_value (img->spec, QCindex, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12551 ino = INTEGERP (image) ? XFASTINT (image) : 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12552 if (ino >= gif->ImageCount) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12553 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12554 image_error ("Invalid image number `%s' in image `%s'", |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12555 image, img->spec); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12556 DGifCloseFile (gif); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12557 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12558 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12559 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12560 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12561 width = img->width = gif->SWidth; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12562 height = img->height = gif->SHeight; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12563 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12564 /* Create the X image and pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12565 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12566 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12567 DGifCloseFile (gif); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12568 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12569 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12570 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12571 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12572 /* Allocate colors. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12573 gif_color_map = gif->SavedImages[ino].ImageDesc.ColorMap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12574 if (!gif_color_map) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12575 gif_color_map = gif->SColorMap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12576 init_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12577 bzero (pixel_colors, sizeof pixel_colors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12578 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12579 for (i = 0; i < gif_color_map->ColorCount; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12580 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12581 int r = gif_color_map->Colors[i].Red << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12582 int g = gif_color_map->Colors[i].Green << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12583 int b = gif_color_map->Colors[i].Blue << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12584 pixel_colors[i] = lookup_rgb_color (f, r, g, b); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12585 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12586 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12587 img->colors = colors_in_color_table (&img->ncolors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12588 free_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12589 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12590 /* Clear the part of the screen image that are not covered by |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12591 the image from the GIF file. Full animated GIF support |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12592 requires more than can be done here (see the gif89 spec, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12593 disposal methods). Let's simply assume that the part |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12594 not covered by a sub-image is in the frame's background color. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12595 image_top = gif->SavedImages[ino].ImageDesc.Top; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12596 image_left = gif->SavedImages[ino].ImageDesc.Left; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12597 image_width = gif->SavedImages[ino].ImageDesc.Width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12598 image_height = gif->SavedImages[ino].ImageDesc.Height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12599 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12600 for (y = 0; y < image_top; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12601 for (x = 0; x < width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12602 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12603 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12604 for (y = image_top + image_height; y < height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12605 for (x = 0; x < width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12606 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12607 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12608 for (y = image_top; y < image_top + image_height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12609 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12610 for (x = 0; x < image_left; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12611 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12612 for (x = image_left + image_width; x < width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12613 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12614 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12615 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12616 /* Read the GIF image into the X image. We use a local variable |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12617 `raster' here because RasterBits below is a char *, and invites |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12618 problems with bytes >= 0x80. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12619 raster = (unsigned char *) gif->SavedImages[ino].RasterBits; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12620 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12621 if (gif->SavedImages[ino].ImageDesc.Interlace) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12622 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12623 static int interlace_start[] = {0, 4, 2, 1}; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12624 static int interlace_increment[] = {8, 8, 4, 2}; |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12625 int pass; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12626 int row = interlace_start[0]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12627 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12628 pass = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12629 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12630 for (y = 0; y < image_height; y++) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12631 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12632 if (row >= image_height) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12633 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12634 row = interlace_start[++pass]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12635 while (row >= image_height) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12636 row = interlace_start[++pass]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12637 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12638 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12639 for (x = 0; x < image_width; x++) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12640 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12641 int i = raster[(y * image_width) + x]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12642 XPutPixel (ximg, x + image_left, row + image_top, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12643 pixel_colors[i]); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12644 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12645 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12646 row += interlace_increment[pass]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12647 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12648 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12649 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12650 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12651 for (y = 0; y < image_height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12652 for (x = 0; x < image_width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12653 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12654 int i = raster[y* image_width + x]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12655 XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12656 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12657 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12658 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12659 DGifCloseFile (gif); |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12660 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12661 /* Maybe fill in the background field while we have ximg handy. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12662 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12663 IMAGE_BACKGROUND (img, f, ximg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12664 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12665 /* Put the image into the pixmap, then free the X image and its buffer. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12666 x_put_x_image (f, ximg, img->pixmap, width, height); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12667 x_destroy_x_image (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12668 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12669 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12670 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12671 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12672 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12673 #endif /* HAVE_GIF != 0 */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12674 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12675 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12676 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12677 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12678 Ghostscript |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12679 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12680 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12681 Lisp_Object Qpostscript; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12682 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12683 #ifdef HAVE_GHOSTSCRIPT |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12684 static int gs_image_p P_ ((Lisp_Object object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12685 static int gs_load P_ ((struct frame *f, struct image *img)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12686 static void gs_clear_image P_ ((struct frame *f, struct image *img)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12687 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12688 /* The symbol `postscript' identifying images of this type. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12689 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12690 /* Keyword symbols. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12691 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12692 Lisp_Object QCloader, QCbounding_box, QCpt_width, QCpt_height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12693 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12694 /* Indices of image specification fields in gs_format, below. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12695 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12696 enum gs_keyword_index |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12697 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12698 GS_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12699 GS_PT_WIDTH, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12700 GS_PT_HEIGHT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12701 GS_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12702 GS_LOADER, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12703 GS_BOUNDING_BOX, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12704 GS_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12705 GS_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12706 GS_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12707 GS_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12708 GS_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12709 GS_MASK, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12710 GS_BACKGROUND, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12711 GS_LAST |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12712 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12713 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12714 /* Vector of image_keyword structures describing the format |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12715 of valid user-defined image specifications. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12716 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12717 static struct image_keyword gs_format[GS_LAST] = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12718 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12719 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12720 {":pt-width", IMAGE_POSITIVE_INTEGER_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12721 {":pt-height", IMAGE_POSITIVE_INTEGER_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12722 {":file", IMAGE_STRING_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12723 {":loader", IMAGE_FUNCTION_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12724 {":bounding-box", IMAGE_DONT_CHECK_VALUE_TYPE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12725 {":ascent", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}, |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
12726 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12727 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
12728 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12729 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12730 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12731 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12732 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12733 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12734 /* Structure describing the image type `ghostscript'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12735 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12736 static struct image_type gs_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12737 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12738 &Qpostscript, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12739 gs_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12740 gs_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12741 gs_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12742 NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12743 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12744 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12745 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12746 /* Free X resources of Ghostscript image IMG which is used on frame F. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12747 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12748 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12749 gs_clear_image (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12750 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12751 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12752 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12753 /* IMG->data.ptr_val may contain a recorded colormap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12754 xfree (img->data.ptr_val); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12755 x_clear_image (f, img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12756 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12757 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12758 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12759 /* Return non-zero if OBJECT is a valid Ghostscript image |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12760 specification. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12761 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12762 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12763 gs_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12764 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12765 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12766 struct image_keyword fmt[GS_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12767 Lisp_Object tem; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12768 int i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12769 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12770 bcopy (gs_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12771 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12772 if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12773 || (fmt[GS_ASCENT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12774 && XFASTINT (fmt[GS_ASCENT].value) > 100)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12775 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12776 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12777 /* Bounding box must be a list or vector containing 4 integers. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12778 tem = fmt[GS_BOUNDING_BOX].value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12779 if (CONSP (tem)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12780 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12781 for (i = 0; i < 4; ++i, tem = XCDR (tem)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12782 if (!CONSP (tem) || !INTEGERP (XCAR (tem))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12783 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12784 if (!NILP (tem)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12785 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12786 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12787 else if (VECTORP (tem)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12788 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12789 if (XVECTOR (tem)->size != 4) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12790 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12791 for (i = 0; i < 4; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12792 if (!INTEGERP (XVECTOR (tem)->contents[i])) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12793 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12794 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12795 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12796 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12797 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12798 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12799 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12800 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12801 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12802 /* Load Ghostscript image IMG for use on frame F. Value is non-zero |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12803 if successful. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12804 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12805 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12806 gs_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12807 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12808 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12809 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12810 char buffer[100]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12811 Lisp_Object window_and_pixmap_id = Qnil, loader, pt_height, pt_width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12812 struct gcpro gcpro1, gcpro2; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12813 Lisp_Object frame; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12814 double in_width, in_height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12815 Lisp_Object pixel_colors = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12816 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12817 /* Compute pixel size of pixmap needed from the given size in the |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12818 image specification. Sizes in the specification are in pt. 1 pt |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12819 = 1/72 in, xdpi and ydpi are stored in the frame's X display |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12820 info. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12821 pt_width = image_spec_value (img->spec, QCpt_width, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12822 in_width = XFASTINT (pt_width) / 72.0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12823 img->width = in_width * FRAME_W32_DISPLAY_INFO (f)->resx; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12824 pt_height = image_spec_value (img->spec, QCpt_height, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12825 in_height = XFASTINT (pt_height) / 72.0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12826 img->height = in_height * FRAME_W32_DISPLAY_INFO (f)->resy; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12827 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12828 /* Create the pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12829 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12830 xassert (img->pixmap == 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12831 img->pixmap = XCreatePixmap (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12832 img->width, img->height, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12833 one_w32_display_info.n_cbits); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12834 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12835 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12836 if (!img->pixmap) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12837 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12838 image_error ("Unable to create pixmap for `%s'", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12839 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12840 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12841 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12842 /* Call the loader to fill the pixmap. It returns a process object |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12843 if successful. We do not record_unwind_protect here because |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12844 other places in redisplay like calling window scroll functions |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12845 don't either. Let the Lisp loader use `unwind-protect' instead. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12846 GCPRO2 (window_and_pixmap_id, pixel_colors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12847 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12848 sprintf (buffer, "%lu %lu", |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12849 (unsigned long) FRAME_W32_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12850 (unsigned long) img->pixmap); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12851 window_and_pixmap_id = build_string (buffer); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12852 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12853 sprintf (buffer, "%lu %lu", |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12854 FRAME_FOREGROUND_PIXEL (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12855 FRAME_BACKGROUND_PIXEL (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12856 pixel_colors = build_string (buffer); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12857 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12858 XSETFRAME (frame, f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12859 loader = image_spec_value (img->spec, QCloader, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12860 if (NILP (loader)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12861 loader = intern ("gs-load-image"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12862 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12863 img->data.lisp_val = call6 (loader, frame, img->spec, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12864 make_number (img->width), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12865 make_number (img->height), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12866 window_and_pixmap_id, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12867 pixel_colors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12868 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12869 return PROCESSP (img->data.lisp_val); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12870 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12871 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12872 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12873 /* Kill the Ghostscript process that was started to fill PIXMAP on |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12874 frame F. Called from XTread_socket when receiving an event |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12875 telling Emacs that Ghostscript has finished drawing. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12876 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12877 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12878 x_kill_gs_process (pixmap, f) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12879 Pixmap pixmap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12880 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12881 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12882 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12883 int class, i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12884 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12885 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12886 /* Find the image containing PIXMAP. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12887 for (i = 0; i < c->used; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12888 if (c->images[i]->pixmap == pixmap) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12889 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12890 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12891 /* Should someone in between have cleared the image cache, for |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12892 instance, give up. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12893 if (i == c->used) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12894 return; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12895 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12896 /* Kill the GS process. We should have found PIXMAP in the image |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12897 cache and its image should contain a process object. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12898 img = c->images[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12899 xassert (PROCESSP (img->data.lisp_val)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12900 Fkill_process (img->data.lisp_val, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12901 img->data.lisp_val = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12902 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12903 /* On displays with a mutable colormap, figure out the colors |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12904 allocated for the image by looking at the pixels of an XImage for |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12905 img->pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12906 class = FRAME_W32_DISPLAY_INFO (f)->visual->class; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12907 if (class != StaticColor && class != StaticGray && class != TrueColor) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12908 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12909 XImage *ximg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12910 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12911 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12912 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12913 /* Try to get an XImage for img->pixmep. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12914 ximg = XGetImage (FRAME_W32_DISPLAY (f), img->pixmap, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12915 0, 0, img->width, img->height, ~0, ZPixmap); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12916 if (ximg) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12917 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12918 int x, y; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12919 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12920 /* Initialize the color table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12921 init_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12922 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12923 /* For each pixel of the image, look its color up in the |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12924 color table. After having done so, the color table will |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12925 contain an entry for each color used by the image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12926 for (y = 0; y < img->height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12927 for (x = 0; x < img->width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12928 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12929 unsigned long pixel = XGetPixel (ximg, x, y); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12930 lookup_pixel_color (f, pixel); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12931 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12932 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12933 /* Record colors in the image. Free color table and XImage. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12934 img->colors = colors_in_color_table (&img->ncolors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12935 free_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12936 XDestroyImage (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12937 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12938 #if 0 /* This doesn't seem to be the case. If we free the colors |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12939 here, we get a BadAccess later in x_clear_image when |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12940 freeing the colors. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12941 /* We have allocated colors once, but Ghostscript has also |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12942 allocated colors on behalf of us. So, to get the |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12943 reference counts right, free them once. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12944 if (img->ncolors) |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12945 x_free_colors (FRAME_W32_DISPLAY (f), cmap, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12946 img->colors, img->ncolors, 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12947 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12948 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12949 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12950 image_error ("Cannot get X image of `%s'; colors will not be freed", |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12951 img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12952 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12953 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12954 } |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12955 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12956 /* Now that we have the pixmap, compute mask and transform the |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12957 image if requested. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12958 BLOCK_INPUT; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12959 postprocess_image (f, img); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12960 UNBLOCK_INPUT; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12961 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12962 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12963 #endif /* HAVE_GHOSTSCRIPT */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12964 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12965 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12966 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12967 Window properties |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12968 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12969 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12970 DEFUN ("x-change-window-property", Fx_change_window_property, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12971 Sx_change_window_property, 2, 3, 0, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
12972 doc: /* Change window property PROP to VALUE on the X window of FRAME. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
12973 PROP and VALUE must be strings. FRAME nil or omitted means use the |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
12974 selected frame. Value is VALUE. */) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12975 (prop, value, frame) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12976 Lisp_Object frame, prop, value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12977 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
12978 #if 0 /* TODO : port window properties to W32 */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12979 struct frame *f = check_x_frame (frame); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12980 Atom prop_atom; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12981 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
12982 CHECK_STRING (prop); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
12983 CHECK_STRING (value); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12984 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12985 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12986 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12987 XChangeProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12988 prop_atom, XA_STRING, 8, PropModeReplace, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12989 XSTRING (value)->data, XSTRING (value)->size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12990 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12991 /* Make sure the property is set when we return. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12992 XFlush (FRAME_W32_DISPLAY (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12993 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12994 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
12995 #endif /* TODO */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12996 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12997 return value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12998 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12999 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13000 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13001 DEFUN ("x-delete-window-property", Fx_delete_window_property, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13002 Sx_delete_window_property, 1, 2, 0, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13003 doc: /* Remove window property PROP from X window of FRAME. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13004 FRAME nil or omitted means use the selected frame. Value is PROP. */) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13005 (prop, frame) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13006 Lisp_Object prop, frame; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13007 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13008 #if 0 /* TODO : port window properties to W32 */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13009 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13010 struct frame *f = check_x_frame (frame); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13011 Atom prop_atom; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13012 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13013 CHECK_STRING (prop); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13014 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13015 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13016 XDeleteProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13017 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13018 /* Make sure the property is removed when we return. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13019 XFlush (FRAME_W32_DISPLAY (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13020 UNBLOCK_INPUT; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13021 #endif /* TODO */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13022 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13023 return prop; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13024 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13025 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13026 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13027 DEFUN ("x-window-property", Fx_window_property, Sx_window_property, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13028 1, 2, 0, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13029 doc: /* Value is the value of window property PROP on FRAME. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13030 If FRAME is nil or omitted, use the selected frame. Value is nil |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13031 if FRAME hasn't a property with name PROP or if PROP has no string |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13032 value. */) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13033 (prop, frame) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13034 Lisp_Object prop, frame; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13035 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13036 #if 0 /* TODO : port window properties to W32 */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13037 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13038 struct frame *f = check_x_frame (frame); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13039 Atom prop_atom; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13040 int rc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13041 Lisp_Object prop_value = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13042 char *tmp_data = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13043 Atom actual_type; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13044 int actual_format; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13045 unsigned long actual_size, bytes_remaining; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13046 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13047 CHECK_STRING (prop); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13048 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13049 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), XSTRING (prop)->data, False); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13050 rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13051 prop_atom, 0, 0, False, XA_STRING, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13052 &actual_type, &actual_format, &actual_size, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13053 &bytes_remaining, (unsigned char **) &tmp_data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13054 if (rc == Success) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13055 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13056 int size = bytes_remaining; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13057 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13058 XFree (tmp_data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13059 tmp_data = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13060 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13061 rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13062 prop_atom, 0, bytes_remaining, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13063 False, XA_STRING, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13064 &actual_type, &actual_format, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13065 &actual_size, &bytes_remaining, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13066 (unsigned char **) &tmp_data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13067 if (rc == Success) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13068 prop_value = make_string (tmp_data, size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13069 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13070 XFree (tmp_data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13071 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13072 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13073 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13074 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13075 return prop_value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13076 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13077 #endif /* TODO */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13078 return Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13079 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13080 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13081 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13082 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13083 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13084 Busy cursor |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13085 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13086 |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13087 /* If non-null, an asynchronous timer that, when it expires, displays |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13088 an hourglass cursor on all frames. */ |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13089 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13090 static struct atimer *hourglass_atimer; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13091 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13092 /* Non-zero means an hourglass cursor is currently shown. */ |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13093 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13094 static int hourglass_shown_p; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13095 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13096 /* Number of seconds to wait before displaying an hourglass cursor. */ |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13097 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13098 static Lisp_Object Vhourglass_delay; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13099 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13100 /* Default number of seconds to wait before displaying an hourglass |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13101 cursor. */ |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13102 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13103 #define DEFAULT_HOURGLASS_DELAY 1 |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13104 |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13105 /* Function prototypes. */ |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13106 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13107 static void show_hourglass P_ ((struct atimer *)); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13108 static void hide_hourglass P_ ((void)); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13109 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13110 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13111 /* Cancel a currently active hourglass timer, and start a new one. */ |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13112 |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13113 void |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13114 start_hourglass () |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13115 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13116 #if 0 /* TODO: cursor shape changes. */ |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13117 EMACS_TIME delay; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
13118 int secs, usecs = 0; |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13119 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13120 cancel_hourglass (); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13121 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13122 if (INTEGERP (Vhourglass_delay) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13123 && XINT (Vhourglass_delay) > 0) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13124 secs = XFASTINT (Vhourglass_delay); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13125 else if (FLOATP (Vhourglass_delay) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13126 && XFLOAT_DATA (Vhourglass_delay) > 0) |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
13127 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
13128 Lisp_Object tem; |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13129 tem = Ftruncate (Vhourglass_delay, Qnil); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
13130 secs = XFASTINT (tem); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13131 usecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000000; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13132 } |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13133 else |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13134 secs = DEFAULT_HOURGLASS_DELAY; |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13135 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
13136 EMACS_SET_SECS_USECS (delay, secs, usecs); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13137 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13138 show_hourglass, NULL); |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13139 #endif |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13140 } |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13141 |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13142 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13143 /* Cancel the hourglass cursor timer if active, hide an hourglass |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13144 cursor if shown. */ |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13145 |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13146 void |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13147 cancel_hourglass () |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13148 { |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13149 if (hourglass_atimer) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13150 { |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13151 cancel_atimer (hourglass_atimer); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13152 hourglass_atimer = NULL; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13153 } |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13154 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13155 if (hourglass_shown_p) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13156 hide_hourglass (); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13157 } |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13158 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13159 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13160 /* Timer function of hourglass_atimer. TIMER is equal to |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13161 hourglass_atimer. |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13162 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13163 Display an hourglass cursor on all frames by mapping the frames' |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13164 hourglass_window. Set the hourglass_p flag in the frames' |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13165 output_data.x structure to indicate that an hourglass cursor is |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13166 shown on the frames. */ |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13167 |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13168 static void |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13169 show_hourglass (timer) |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13170 struct atimer *timer; |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13171 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13172 #if 0 /* TODO: cursor shape changes. */ |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13173 /* The timer implementation will cancel this timer automatically |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13174 after this function has run. Set hourglass_atimer to null |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13175 so that we know the timer doesn't have to be canceled. */ |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13176 hourglass_atimer = NULL; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13177 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13178 if (!hourglass_shown_p) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13179 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13180 Lisp_Object rest, frame; |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13181 |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13182 BLOCK_INPUT; |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13183 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13184 FOR_EACH_FRAME (rest, frame) |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13185 if (FRAME_W32_P (XFRAME (frame))) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13186 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13187 struct frame *f = XFRAME (frame); |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13188 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13189 f->output_data.w32->hourglass_p = 1; |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13190 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13191 if (!f->output_data.w32->hourglass_window) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13192 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13193 unsigned long mask = CWCursor; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13194 XSetWindowAttributes attrs; |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13195 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13196 attrs.cursor = f->output_data.w32->hourglass_cursor; |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13197 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13198 f->output_data.w32->hourglass_window |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13199 = XCreateWindow (FRAME_X_DISPLAY (f), |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13200 FRAME_OUTER_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13201 0, 0, 32000, 32000, 0, 0, |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13202 InputOnly, |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13203 CopyFromParent, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13204 mask, &attrs); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13205 } |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13206 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13207 XMapRaised (FRAME_X_DISPLAY (f), |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13208 f->output_data.w32->hourglass_window); |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13209 XFlush (FRAME_X_DISPLAY (f)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13210 } |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13211 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13212 hourglass_shown_p = 1; |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13213 UNBLOCK_INPUT; |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13214 } |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13215 #endif |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13216 } |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13217 |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13218 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13219 /* Hide the hourglass cursor on all frames, if it is currently shown. */ |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13220 |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13221 static void |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13222 hide_hourglass () |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13223 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13224 #if 0 /* TODO: cursor shape changes. */ |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13225 if (hourglass_shown_p) |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13226 { |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13227 Lisp_Object rest, frame; |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13228 |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13229 BLOCK_INPUT; |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13230 FOR_EACH_FRAME (rest, frame) |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13231 { |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13232 struct frame *f = XFRAME (frame); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13233 |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13234 if (FRAME_W32_P (f) |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13235 /* Watch out for newly created frames. */ |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13236 && f->output_data.x->hourglass_window) |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13237 { |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13238 XUnmapWindow (FRAME_X_DISPLAY (f), |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13239 f->output_data.x->hourglass_window); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13240 /* Sync here because XTread_socket looks at the |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13241 hourglass_p flag that is reset to zero below. */ |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13242 XSync (FRAME_X_DISPLAY (f), False); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13243 f->output_data.x->hourglass_p = 0; |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13244 } |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13245 } |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13246 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13247 hourglass_shown_p = 0; |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13248 UNBLOCK_INPUT; |
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
13249 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13250 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13251 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13252 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13253 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13254 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13255 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13256 Tool tips |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13257 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13258 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13259 static Lisp_Object x_create_tip_frame P_ ((struct w32_display_info *, |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13260 Lisp_Object, Lisp_Object)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13261 static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13262 Lisp_Object, int, int, int *, int *)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13263 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13264 /* The frame of a currently visible tooltip. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13265 |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13266 Lisp_Object tip_frame; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13267 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13268 /* If non-nil, a timer started that hides the last tooltip when it |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13269 fires. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13270 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13271 Lisp_Object tip_timer; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13272 Window tip_window; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13273 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13274 /* If non-nil, a vector of 3 elements containing the last args |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13275 with which x-show-tip was called. See there. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13276 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13277 Lisp_Object last_show_tip_args; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13278 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13279 /* Maximum size for tooltips; a cons (COLUMNS . ROWS). */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13280 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13281 Lisp_Object Vx_max_tooltip_size; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13282 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13283 |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13284 static Lisp_Object |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13285 unwind_create_tip_frame (frame) |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13286 Lisp_Object frame; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13287 { |
34638
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13288 Lisp_Object deleted; |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13289 |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13290 deleted = unwind_create_frame (frame); |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13291 if (EQ (deleted, Qt)) |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13292 { |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13293 tip_window = NULL; |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13294 tip_frame = Qnil; |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13295 } |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13296 |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13297 return deleted; |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13298 } |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13299 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13300 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13301 /* Create a frame for a tooltip on the display described by DPYINFO. |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13302 PARMS is a list of frame parameters. TEXT is the string to |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13303 display in the tip frame. Value is the frame. |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13304 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13305 Note that functions called here, esp. x_default_parameter can |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13306 signal errors, for instance when a specified color name is |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13307 undefined. We have to make sure that we're in a consistent state |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13308 when this happens. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13309 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13310 static Lisp_Object |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13311 x_create_tip_frame (dpyinfo, parms, text) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13312 struct w32_display_info *dpyinfo; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13313 Lisp_Object parms, text; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13314 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13315 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13316 Lisp_Object frame, tem; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13317 Lisp_Object name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13318 long window_prompting = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13319 int width, height; |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13320 int count = BINDING_STACK_SIZE (); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13321 struct gcpro gcpro1, gcpro2, gcpro3; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13322 struct kboard *kb; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13323 int face_change_count_before = face_change_count; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13324 Lisp_Object buffer; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13325 struct buffer *old_buffer; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13326 |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13327 check_w32 (); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13328 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13329 /* Use this general default value to start with until we know if |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13330 this frame has a specified name. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13331 Vx_resource_name = Vinvocation_name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13332 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13333 #ifdef MULTI_KBOARD |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13334 kb = dpyinfo->kboard; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13335 #else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13336 kb = &the_only_kboard; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13337 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13338 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13339 /* Get the name of the frame to use for resource lookup. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13340 name = w32_get_arg (parms, Qname, "name", "Name", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13341 if (!STRINGP (name) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13342 && !EQ (name, Qunbound) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13343 && !NILP (name)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13344 error ("Invalid frame name--not a string or nil"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13345 Vx_resource_name = name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13346 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13347 frame = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13348 GCPRO3 (parms, name, frame); |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
13349 /* Make a frame without minibuffer nor mode-line. */ |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
13350 f = make_frame (0); |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
13351 f->wants_modeline = 0; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13352 XSETFRAME (frame, f); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13353 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13354 buffer = Fget_buffer_create (build_string (" *tip*")); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13355 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13356 old_buffer = current_buffer; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13357 set_buffer_internal_1 (XBUFFER (buffer)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13358 current_buffer->truncate_lines = Qnil; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13359 Ferase_buffer (); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13360 Finsert (1, &text); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13361 set_buffer_internal_1 (old_buffer); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13362 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13363 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13364 record_unwind_protect (unwind_create_tip_frame, frame); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13365 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13366 /* By setting the output method, we're essentially saying that |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13367 the frame is live, as per FRAME_LIVE_P. If we get a signal |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13368 from this point on, x_destroy_window might screw up reference |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13369 counts etc. */ |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
13370 f->output_method = output_w32; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13371 f->output_data.w32 = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13372 (struct w32_output *) xmalloc (sizeof (struct w32_output)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13373 bzero (f->output_data.w32, sizeof (struct w32_output)); |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13374 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13375 FRAME_FONTSET (f) = -1; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13376 f->icon_name = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13377 |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13378 #if 0 /* GLYPH_DEBUG TODO: image support. */ |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13379 image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13380 dpyinfo_refcount = dpyinfo->reference_count; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13381 #endif /* GLYPH_DEBUG */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13382 #ifdef MULTI_KBOARD |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13383 FRAME_KBOARD (f) = kb; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13384 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13385 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13386 f->output_data.w32->explicit_parent = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13387 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13388 /* Set the name; the functions to which we pass f expect the name to |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13389 be set. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13390 if (EQ (name, Qunbound) || NILP (name)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13391 { |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13392 f->name = build_string (dpyinfo->w32_id_name); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13393 f->explicit_name = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13394 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13395 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13396 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13397 f->name = name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13398 f->explicit_name = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13399 /* use the frame's title when getting resources for this frame. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13400 specbind (Qx_resource_name, name); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13401 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13402 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13403 /* Extract the window parameters from the supplied values |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13404 that are needed to determine window geometry. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13405 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13406 Lisp_Object font; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13407 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13408 font = w32_get_arg (parms, Qfont, "font", "Font", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13409 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13410 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13411 /* First, try whatever font the caller has specified. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13412 if (STRINGP (font)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13413 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13414 tem = Fquery_fontset (font, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13415 if (STRINGP (tem)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13416 font = x_new_fontset (f, XSTRING (tem)->data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13417 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13418 font = x_new_font (f, XSTRING (font)->data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13419 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13420 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13421 /* Try out a font which we hope has bold and italic variations. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13422 if (!STRINGP (font)) |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13423 font = x_new_font (f, "-*-Courier New-normal-r-*-*-*-100-*-*-c-*-iso8859-1"); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13424 if (! STRINGP (font)) |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13425 font = x_new_font (f, "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1"); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13426 /* If those didn't work, look for something which will at least work. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13427 if (! STRINGP (font)) |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13428 font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1"); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13429 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13430 if (! STRINGP (font)) |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13431 font = build_string ("Fixedsys"); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13432 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13433 x_default_parameter (f, parms, Qfont, font, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13434 "font", "Font", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13435 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13436 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13437 x_default_parameter (f, parms, Qborder_width, make_number (2), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13438 "borderWidth", "BorderWidth", RES_TYPE_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13439 /* This defaults to 2 in order to match xterm. We recognize either |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13440 internalBorderWidth or internalBorder (which is what xterm calls |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13441 it). */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13442 if (NILP (Fassq (Qinternal_border_width, parms))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13443 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13444 Lisp_Object value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13445 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13446 value = w32_get_arg (parms, Qinternal_border_width, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13447 "internalBorder", "internalBorder", RES_TYPE_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13448 if (! EQ (value, Qunbound)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13449 parms = Fcons (Fcons (Qinternal_border_width, value), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13450 parms); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13451 } |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13452 x_default_parameter (f, parms, Qinternal_border_width, make_number (1), |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13453 "internalBorderWidth", "internalBorderWidth", |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13454 RES_TYPE_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13455 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13456 /* Also do the stuff which must be set before the window exists. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13457 x_default_parameter (f, parms, Qforeground_color, build_string ("black"), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13458 "foreground", "Foreground", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13459 x_default_parameter (f, parms, Qbackground_color, build_string ("white"), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13460 "background", "Background", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13461 x_default_parameter (f, parms, Qmouse_color, build_string ("black"), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13462 "pointerColor", "Foreground", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13463 x_default_parameter (f, parms, Qcursor_color, build_string ("black"), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13464 "cursorColor", "Foreground", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13465 x_default_parameter (f, parms, Qborder_color, build_string ("black"), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13466 "borderColor", "BorderColor", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13467 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13468 /* Init faces before x_default_parameter is called for scroll-bar |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13469 parameters because that function calls x_set_scroll_bar_width, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13470 which calls change_frame_size, which calls Fset_window_buffer, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13471 which runs hooks, which call Fvertical_motion. At the end, we |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13472 end up in init_iterator with a null face cache, which should not |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13473 happen. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13474 init_frame_faces (f); |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13475 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13476 f->output_data.w32->dwStyle = WS_BORDER | WS_POPUP | WS_DISABLED; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13477 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
13478 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13479 window_prompting = x_figure_window_size (f, parms); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13480 |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
13481 /* No fringes on tip frame. */ |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
13482 f->output_data.w32->fringes_extra = 0; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
13483 f->output_data.w32->fringe_cols = 0; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
13484 f->output_data.w32->left_fringe_width = 0; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
13485 f->output_data.w32->right_fringe_width = 0; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
13486 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13487 if (window_prompting & XNegative) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13488 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13489 if (window_prompting & YNegative) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13490 f->output_data.w32->win_gravity = SouthEastGravity; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13491 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13492 f->output_data.w32->win_gravity = NorthEastGravity; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13493 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13494 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13495 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13496 if (window_prompting & YNegative) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13497 f->output_data.w32->win_gravity = SouthWestGravity; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13498 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13499 f->output_data.w32->win_gravity = NorthWestGravity; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13500 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13501 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13502 f->output_data.w32->size_hint_flags = window_prompting; |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13503 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13504 BLOCK_INPUT; |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13505 my_create_tip_window (f); |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13506 UNBLOCK_INPUT; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13507 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13508 x_make_gc (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13509 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13510 x_default_parameter (f, parms, Qauto_raise, Qnil, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13511 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13512 x_default_parameter (f, parms, Qauto_lower, Qnil, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13513 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13514 x_default_parameter (f, parms, Qcursor_type, Qbox, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13515 "cursorType", "CursorType", RES_TYPE_SYMBOL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13516 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13517 /* Dimensions, especially f->height, must be done via change_frame_size. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13518 Change will not be effected unless different from the current |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13519 f->height. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13520 width = f->width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13521 height = f->height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13522 f->height = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13523 SET_FRAME_WIDTH (f, 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13524 change_frame_size (f, height, width, 1, 0, 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13525 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13526 /* Set up faces after all frame parameters are known. This call |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13527 also merges in face attributes specified for new frames. |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13528 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13529 Frame parameters may be changed if .Xdefaults contains |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13530 specifications for the default font. For example, if there is an |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13531 `Emacs.default.attributeBackground: pink', the `background-color' |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13532 attribute of the frame get's set, which let's the internal border |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13533 of the tooltip frame appear in pink. Prevent this. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13534 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13535 Lisp_Object bg = Fframe_parameter (frame, Qbackground_color); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13536 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13537 /* Set tip_frame here, so that */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13538 tip_frame = frame; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13539 call1 (Qface_set_after_frame_default, frame); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13540 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13541 if (!EQ (bg, Fframe_parameter (frame, Qbackground_color))) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13542 Fmodify_frame_parameters (frame, Fcons (Fcons (Qbackground_color, bg), |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13543 Qnil)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13544 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13545 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13546 f->no_split = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13547 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13548 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13549 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13550 /* It is now ok to make the frame official even if we get an error |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13551 below. And the frame needs to be on Vframe_list or making it |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13552 visible won't work. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13553 Vframe_list = Fcons (frame, Vframe_list); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13554 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13555 /* Now that the frame is official, it counts as a reference to |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13556 its display. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13557 FRAME_W32_DISPLAY_INFO (f)->reference_count++; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13558 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13559 /* Setting attributes of faces of the tooltip frame from resources |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13560 and similar will increment face_change_count, which leads to the |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13561 clearing of all current matrices. Since this isn't necessary |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13562 here, avoid it by resetting face_change_count to the value it |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13563 had before we created the tip frame. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13564 face_change_count = face_change_count_before; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13565 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13566 /* Discard the unwind_protect. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13567 return unbind_to (count, frame); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13568 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13569 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13570 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13571 /* Compute where to display tip frame F. PARMS is the list of frame |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13572 parameters for F. DX and DY are specified offsets from the current |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13573 location of the mouse. WIDTH and HEIGHT are the width and height |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13574 of the tooltip. Return coordinates relative to the root window of |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13575 the display in *ROOT_X, and *ROOT_Y. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13576 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13577 static void |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13578 compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13579 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13580 Lisp_Object parms, dx, dy; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13581 int width, height; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13582 int *root_x, *root_y; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13583 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13584 Lisp_Object left, top; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13585 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13586 /* User-specified position? */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13587 left = Fcdr (Fassq (Qleft, parms)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13588 top = Fcdr (Fassq (Qtop, parms)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13589 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13590 /* Move the tooltip window where the mouse pointer is. Resize and |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13591 show it. */ |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13592 if (!INTEGERP (left) || !INTEGERP (top)) |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13593 { |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13594 POINT pt; |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13595 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13596 BLOCK_INPUT; |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13597 GetCursorPos (&pt); |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13598 *root_x = pt.x; |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13599 *root_y = pt.y; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13600 UNBLOCK_INPUT; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13601 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13602 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13603 if (INTEGERP (top)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13604 *root_y = XINT (top); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13605 else if (*root_y + XINT (dy) - height < 0) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13606 *root_y -= XINT (dy); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13607 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13608 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13609 *root_y -= height; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13610 *root_y += XINT (dy); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13611 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13612 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13613 if (INTEGERP (left)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13614 *root_x = XINT (left); |
42537
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
13615 else if (*root_x + XINT (dx) + width <= FRAME_W32_DISPLAY_INFO (f)->width) |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
13616 /* It fits to the right of the pointer. */ |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
13617 *root_x += XINT (dx); |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
13618 else if (width + XINT (dx) <= *root_x) |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
13619 /* It fits to the left of the pointer. */ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13620 *root_x -= width + XINT (dx); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13621 else |
42537
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
13622 /* Put it left justified on the screen -- it ought to fit that way. */ |
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
13623 *root_x = 0; |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13624 } |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13625 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13626 |
31110 | 13627 DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13628 doc: /* Show STRING in a \"tooltip\" window on frame FRAME. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13629 A tooltip window is a small window displaying a string. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13630 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13631 FRAME nil or omitted means use the selected frame. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13632 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13633 PARMS is an optional list of frame parameters which can be |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13634 used to change the tooltip's appearance. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13635 |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13636 Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13637 means use the default timeout of 5 seconds. |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13638 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13639 If the list of frame parameters PARAMS contains a `left' parameter, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13640 the tooltip is displayed at that x-position. Otherwise it is |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13641 displayed at the mouse position, with offset DX added (default is 5 if |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13642 DX isn't specified). Likewise for the y-position; if a `top' frame |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13643 parameter is specified, it determines the y-position of the tooltip |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13644 window, otherwise it is displayed at the mouse position, with offset |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13645 DY added (default is -10). |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13646 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13647 A tooltip's maximum size is specified by `x-max-tooltip-size'. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13648 Text larger than the specified size is clipped. */) |
31110 | 13649 (string, frame, parms, timeout, dx, dy) |
13650 Lisp_Object string, frame, parms, timeout, dx, dy; | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13651 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13652 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13653 struct window *w; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13654 int root_x, root_y; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13655 struct buffer *old_buffer; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13656 struct text_pos pos; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13657 int i, width, height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13658 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13659 int old_windows_or_buffers_changed = windows_or_buffers_changed; |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13660 int count = BINDING_STACK_SIZE (); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13661 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13662 specbind (Qinhibit_redisplay, Qt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13663 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
13664 GCPRO4 (string, parms, frame, timeout); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13665 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13666 CHECK_STRING (string); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13667 f = check_x_frame (frame); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13668 if (NILP (timeout)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13669 timeout = make_number (5); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13670 else |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13671 CHECK_NATNUM (timeout); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13672 |
31110 | 13673 if (NILP (dx)) |
13674 dx = make_number (5); | |
13675 else | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13676 CHECK_NUMBER (dx); |
31110 | 13677 |
13678 if (NILP (dy)) | |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13679 dy = make_number (-10); |
31110 | 13680 else |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13681 CHECK_NUMBER (dy); |
31110 | 13682 |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13683 if (NILP (last_show_tip_args)) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13684 last_show_tip_args = Fmake_vector (make_number (3), Qnil); |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13685 |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13686 if (!NILP (tip_frame)) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13687 { |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13688 Lisp_Object last_string = AREF (last_show_tip_args, 0); |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13689 Lisp_Object last_frame = AREF (last_show_tip_args, 1); |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13690 Lisp_Object last_parms = AREF (last_show_tip_args, 2); |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13691 |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13692 if (EQ (frame, last_frame) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13693 && !NILP (Fequal (last_string, string)) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13694 && !NILP (Fequal (last_parms, parms))) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13695 { |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13696 struct frame *f = XFRAME (tip_frame); |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13697 |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13698 /* Only DX and DY have changed. */ |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13699 if (!NILP (tip_timer)) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13700 { |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13701 Lisp_Object timer = tip_timer; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13702 tip_timer = Qnil; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13703 call1 (Qcancel_timer, timer); |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13704 } |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13705 |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13706 BLOCK_INPUT; |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13707 compute_tip_xy (f, parms, dx, dy, PIXEL_WIDTH (f), |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13708 PIXEL_HEIGHT (f), &root_x, &root_y); |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13709 SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOPMOST, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13710 root_x, root_y, 0, 0, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13711 SWP_NOSIZE | SWP_NOACTIVATE); |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13712 UNBLOCK_INPUT; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13713 goto start_timer; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13714 } |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13715 } |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13716 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13717 /* Hide a previous tip, if any. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13718 Fx_hide_tip (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13719 |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13720 ASET (last_show_tip_args, 0, string); |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13721 ASET (last_show_tip_args, 1, frame); |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13722 ASET (last_show_tip_args, 2, parms); |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13723 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13724 /* Add default values to frame parameters. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13725 if (NILP (Fassq (Qname, parms))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13726 parms = Fcons (Fcons (Qname, build_string ("tooltip")), parms); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13727 if (NILP (Fassq (Qinternal_border_width, parms))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13728 parms = Fcons (Fcons (Qinternal_border_width, make_number (3)), parms); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13729 if (NILP (Fassq (Qborder_width, parms))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13730 parms = Fcons (Fcons (Qborder_width, make_number (1)), parms); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13731 if (NILP (Fassq (Qborder_color, parms))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13732 parms = Fcons (Fcons (Qborder_color, build_string ("lightyellow")), parms); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13733 if (NILP (Fassq (Qbackground_color, parms))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13734 parms = Fcons (Fcons (Qbackground_color, build_string ("lightyellow")), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13735 parms); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13736 |
41480
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
13737 /* Block input until the tip has been fully drawn, to avoid crashes |
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
13738 when drawing tips in menus. */ |
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
13739 BLOCK_INPUT; |
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
13740 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13741 /* Create a frame for the tooltip, and record it in the global |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13742 variable tip_frame. */ |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13743 frame = x_create_tip_frame (FRAME_W32_DISPLAY_INFO (f), parms, string); |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13744 f = XFRAME (frame); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13745 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13746 /* Set up the frame's root window. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13747 w = XWINDOW (FRAME_ROOT_WINDOW (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13748 w->left = w->top = make_number (0); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13749 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13750 if (CONSP (Vx_max_tooltip_size) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13751 && INTEGERP (XCAR (Vx_max_tooltip_size)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13752 && XINT (XCAR (Vx_max_tooltip_size)) > 0 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13753 && INTEGERP (XCDR (Vx_max_tooltip_size)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13754 && XINT (XCDR (Vx_max_tooltip_size)) > 0) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13755 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13756 w->width = XCAR (Vx_max_tooltip_size); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13757 w->height = XCDR (Vx_max_tooltip_size); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13758 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13759 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13760 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13761 w->width = make_number (80); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13762 w->height = make_number (40); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13763 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13764 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13765 f->window_width = XINT (w->width); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13766 adjust_glyphs (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13767 w->pseudo_window_p = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13768 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13769 /* Display the tooltip text in a temporary buffer. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13770 old_buffer = current_buffer; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13771 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13772 current_buffer->truncate_lines = Qnil; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13773 clear_glyph_matrix (w->desired_matrix); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13774 clear_glyph_matrix (w->current_matrix); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13775 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13776 try_window (FRAME_ROOT_WINDOW (f), pos); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13777 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13778 /* Compute width and height of the tooltip. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13779 width = height = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13780 for (i = 0; i < w->desired_matrix->nrows; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13781 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13782 struct glyph_row *row = &w->desired_matrix->rows[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13783 struct glyph *last; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13784 int row_width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13785 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13786 /* Stop at the first empty row at the end. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13787 if (!row->enabled_p || !row->displays_text_p) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13788 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13789 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13790 /* Let the row go over the full width of the frame. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13791 row->full_width_p = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13792 |
41638
aadcf676d5de
(w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents:
41480
diff
changeset
|
13793 #ifdef TODO /* Investigate why some fonts need more width than is |
aadcf676d5de
(w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents:
41480
diff
changeset
|
13794 calculated for some tooltips. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13795 /* There's a glyph at the end of rows that is use to place |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13796 the cursor there. Don't include the width of this glyph. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13797 if (row->used[TEXT_AREA]) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13798 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13799 last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13800 row_width = row->pixel_width - last->pixel_width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13801 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13802 else |
41638
aadcf676d5de
(w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents:
41480
diff
changeset
|
13803 #endif |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13804 row_width = row->pixel_width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13805 |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13806 /* TODO: find why tips do not draw along baseline as instructed. */ |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13807 height += row->height; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13808 width = max (width, row_width); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13809 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13810 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13811 /* Add the frame's internal border to the width and height the X |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13812 window should have. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13813 height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13814 width += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13815 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13816 /* Move the tooltip window where the mouse pointer is. Resize and |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13817 show it. */ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13818 compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13819 |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13820 { |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13821 /* Adjust Window size to take border into account. */ |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13822 RECT rect; |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13823 rect.left = rect.top = 0; |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13824 rect.right = width; |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13825 rect.bottom = height; |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13826 AdjustWindowRect (&rect, f->output_data.w32->dwStyle, |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13827 FRAME_EXTERNAL_MENU_BAR (f)); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13828 |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13829 SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOPMOST, |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13830 root_x, root_y, rect.right - rect.left, |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13831 rect.bottom - rect.top, SWP_NOACTIVATE); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13832 |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13833 /* Let redisplay know that we have made the frame visible already. */ |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13834 f->async_visible = 1; |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13835 |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13836 ShowWindow (FRAME_W32_WINDOW (f), SW_SHOWNOACTIVATE); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13837 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13838 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13839 /* Draw into the window. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13840 w->must_be_updated_p = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13841 update_single_window (w, 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13842 |
41480
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
13843 UNBLOCK_INPUT; |
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
13844 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13845 /* Restore original current buffer. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13846 set_buffer_internal_1 (old_buffer); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13847 windows_or_buffers_changed = old_windows_or_buffers_changed; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13848 |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13849 start_timer: |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13850 /* Let the tip disappear after timeout seconds. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13851 tip_timer = call3 (intern ("run-at-time"), timeout, Qnil, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13852 intern ("x-hide-tip")); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
13853 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13854 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13855 return unbind_to (count, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13856 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13857 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13858 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13859 DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13860 doc: /* Hide the current tooltip window, if there is any. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13861 Value is t if tooltip was open, nil otherwise. */) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13862 () |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13863 { |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13864 int count; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13865 Lisp_Object deleted, frame, timer; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13866 struct gcpro gcpro1, gcpro2; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13867 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13868 /* Return quickly if nothing to do. */ |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13869 if (NILP (tip_timer) && NILP (tip_frame)) |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13870 return Qnil; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13871 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13872 frame = tip_frame; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13873 timer = tip_timer; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13874 GCPRO2 (frame, timer); |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13875 tip_frame = tip_timer = deleted = Qnil; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13876 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13877 count = BINDING_STACK_SIZE (); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13878 specbind (Qinhibit_redisplay, Qt); |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13879 specbind (Qinhibit_quit, Qt); |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13880 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13881 if (!NILP (timer)) |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13882 call1 (Qcancel_timer, timer); |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13883 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13884 if (FRAMEP (frame)) |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13885 { |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13886 Fdelete_frame (frame, Qnil); |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13887 deleted = Qt; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13888 } |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13889 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13890 UNGCPRO; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13891 return unbind_to (count, deleted); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13892 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13893 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13894 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13895 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13896 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13897 File selection dialog |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13898 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13899 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13900 extern Lisp_Object Qfile_name_history; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13901 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13902 DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13903 doc: /* Read file name, prompting with PROMPT in directory DIR. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13904 Use a file selection dialog. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13905 Select DEFAULT-FILENAME in the dialog's file selection box, if |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13906 specified. Ensure that file exists if MUSTMATCH is non-nil. */) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13907 (prompt, dir, default_filename, mustmatch) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13908 Lisp_Object prompt, dir, default_filename, mustmatch; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13909 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13910 struct frame *f = SELECTED_FRAME (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13911 Lisp_Object file = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13912 int count = specpdl_ptr - specpdl; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13913 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13914 char filename[MAX_PATH + 1]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13915 char init_dir[MAX_PATH + 1]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13916 int use_dialog_p = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13917 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13918 GCPRO5 (prompt, dir, default_filename, mustmatch, file); |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13919 CHECK_STRING (prompt); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13920 CHECK_STRING (dir); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13921 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13922 /* Create the dialog with PROMPT as title, using DIR as initial |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13923 directory and using "*" as pattern. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13924 dir = Fexpand_file_name (dir, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13925 strncpy (init_dir, XSTRING (dir)->data, MAX_PATH); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13926 init_dir[MAX_PATH] = '\0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13927 unixtodos_filename (init_dir); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13928 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13929 if (STRINGP (default_filename)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13930 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13931 char *file_name_only; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13932 char *full_path_name = XSTRING (default_filename)->data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13933 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13934 unixtodos_filename (full_path_name); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13935 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13936 file_name_only = strrchr (full_path_name, '\\'); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13937 if (!file_name_only) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13938 file_name_only = full_path_name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13939 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13940 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13941 file_name_only++; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13942 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13943 /* If default_file_name is a directory, don't use the open |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13944 file dialog, as it does not support selecting |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13945 directories. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13946 if (!(*file_name_only)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13947 use_dialog_p = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13948 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13949 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13950 strncpy (filename, file_name_only, MAX_PATH); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13951 filename[MAX_PATH] = '\0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13952 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13953 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13954 filename[0] = '\0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13955 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13956 if (use_dialog_p) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13957 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13958 OPENFILENAME file_details; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13959 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13960 /* Prevent redisplay. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13961 specbind (Qinhibit_redisplay, Qt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13962 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13963 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13964 bzero (&file_details, sizeof (file_details)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13965 file_details.lStructSize = sizeof (file_details); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13966 file_details.hwndOwner = FRAME_W32_WINDOW (f); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13967 /* Undocumented Bug in Common File Dialog: |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13968 If a filter is not specified, shell links are not resolved. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13969 file_details.lpstrFilter = "ALL Files (*.*)\0*.*\0\0"; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13970 file_details.lpstrFile = filename; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13971 file_details.nMaxFile = sizeof (filename); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13972 file_details.lpstrInitialDir = init_dir; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13973 file_details.lpstrTitle = XSTRING (prompt)->data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13974 file_details.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13975 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13976 if (!NILP (mustmatch)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13977 file_details.Flags |= OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13978 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13979 if (GetOpenFileName (&file_details)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13980 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13981 dostounix_filename (filename); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13982 file = build_string (filename); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13983 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13984 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13985 file = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13986 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13987 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13988 file = unbind_to (count, file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13989 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13990 /* Open File dialog will not allow folders to be selected, so resort |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13991 to minibuffer completing reads for directories. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13992 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13993 file = Fcompleting_read (prompt, intern ("read-file-name-internal"), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13994 dir, mustmatch, dir, Qfile_name_history, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13995 default_filename, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13996 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13997 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13998 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13999 /* Make "Cancel" equivalent to C-g. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14000 if (NILP (file)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14001 Fsignal (Qquit, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14002 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14003 return unbind_to (count, file); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14004 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14005 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14006 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14007 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14008 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14009 w32 specialized functions |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14010 ***********************************************************************/ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14011 |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14012 DEFUN ("w32-select-font", Fw32_select_font, Sw32_select_font, 0, 2, 0, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14013 doc: /* Select a font using the W32 font dialog. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14014 Returns an X font string corresponding to the selection. */) |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14015 (frame, include_proportional) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14016 Lisp_Object frame, include_proportional; |
13434 | 14017 { |
14018 FRAME_PTR f = check_x_frame (frame); | |
14019 CHOOSEFONT cf; | |
14020 LOGFONT lf; | |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14021 TEXTMETRIC tm; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14022 HDC hdc; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14023 HANDLE oldobj; |
13434 | 14024 char buf[100]; |
14025 | |
14026 bzero (&cf, sizeof (cf)); | |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14027 bzero (&lf, sizeof (lf)); |
13434 | 14028 |
14029 cf.lStructSize = sizeof (cf); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14030 cf.hwndOwner = FRAME_W32_WINDOW (f); |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14031 cf.Flags = CF_FORCEFONTEXIST | CF_SCREENFONTS | CF_NOVERTFONTS; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14032 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14033 /* Unless include_proportional is non-nil, limit the selection to |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14034 monospaced fonts. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14035 if (NILP (include_proportional)) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14036 cf.Flags |= CF_FIXEDPITCHONLY; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14037 |
13434 | 14038 cf.lpLogFont = &lf; |
14039 | |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14040 /* Initialize as much of the font details as we can from the current |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14041 default font. */ |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14042 hdc = GetDC (FRAME_W32_WINDOW (f)); |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14043 oldobj = SelectObject (hdc, FRAME_FONT (f)->hfont); |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14044 GetTextFace (hdc, LF_FACESIZE, lf.lfFaceName); |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14045 if (GetTextMetrics (hdc, &tm)) |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14046 { |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14047 lf.lfHeight = tm.tmInternalLeading - tm.tmHeight; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14048 lf.lfWeight = tm.tmWeight; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14049 lf.lfItalic = tm.tmItalic; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14050 lf.lfUnderline = tm.tmUnderlined; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14051 lf.lfStrikeOut = tm.tmStruckOut; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14052 lf.lfCharSet = tm.tmCharSet; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14053 cf.Flags |= CF_INITTOLOGFONTSTRUCT; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14054 } |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14055 SelectObject (hdc, oldobj); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14056 ReleaseDC (FRAME_W32_WINDOW (f), hdc); |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14057 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
14058 if (!ChooseFont (&cf) || !w32_to_x_font (&lf, buf, 100, NULL)) |
14353 | 14059 return Qnil; |
13434 | 14060 |
14061 return build_string (buf); | |
14062 } | |
14063 | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14064 DEFUN ("w32-send-sys-command", Fw32_send_sys_command, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14065 Sw32_send_sys_command, 1, 2, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14066 doc: /* Send frame a Windows WM_SYSCOMMAND message of type COMMAND. |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14067 Some useful values for command are #xf030 to maximise frame (#xf020 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14068 to minimize), #xf120 to restore frame to original size, and #xf100 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14069 to activate the menubar for keyboard access. #xf140 activates the |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14070 screen saver if defined. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14071 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14072 If optional parameter FRAME is not specified, use selected frame. */) |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14073 (command, frame) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14074 Lisp_Object command, frame; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14075 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14076 FRAME_PTR f = check_x_frame (frame); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14077 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
14078 CHECK_NUMBER (command); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14079 |
24718
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
14080 PostMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, XINT (command), 0); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14081 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14082 return Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14083 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14084 |
24670 | 14085 DEFUN ("w32-shell-execute", Fw32_shell_execute, Sw32_shell_execute, 2, 4, 0, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14086 doc: /* Get Windows to perform OPERATION on DOCUMENT. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14087 This is a wrapper around the ShellExecute system function, which |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14088 invokes the application registered to handle OPERATION for DOCUMENT. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14089 OPERATION is typically \"open\", \"print\" or \"explore\" (but can be |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14090 nil for the default action), and DOCUMENT is typically the name of a |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14091 document file or URL, but can also be a program executable to run or |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14092 a directory to open in the Windows Explorer. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14093 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14094 If DOCUMENT is a program executable, PARAMETERS can be a string |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14095 containing command line parameters, but otherwise should be nil. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14096 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14097 SHOW-FLAG can be used to control whether the invoked application is hidden |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14098 or minimized. If SHOW-FLAG is nil, the application is displayed normally, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14099 otherwise it is an integer representing a ShowWindow flag: |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14100 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14101 0 - start hidden |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14102 1 - start normally |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14103 3 - start maximized |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14104 6 - start minimized */) |
24670 | 14105 (operation, document, parameters, show_flag) |
14106 Lisp_Object operation, document, parameters, show_flag; | |
14107 { | |
14108 Lisp_Object current_dir; | |
14109 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
14110 CHECK_STRING (document); |
24670 | 14111 |
14112 /* Encode filename and current directory. */ | |
14113 current_dir = ENCODE_FILE (current_buffer->directory); | |
14114 document = ENCODE_FILE (document); | |
14115 if ((int) ShellExecute (NULL, | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14116 (STRINGP (operation) ? |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14117 XSTRING (operation)->data : NULL), |
24670 | 14118 XSTRING (document)->data, |
14119 (STRINGP (parameters) ? | |
14120 XSTRING (parameters)->data : NULL), | |
14121 XSTRING (current_dir)->data, | |
14122 (INTEGERP (show_flag) ? | |
14123 XINT (show_flag) : SW_SHOWDEFAULT)) | |
14124 > 32) | |
14125 return Qt; | |
34698
cc62e2e0949d
(Fw32_shell_execute): Use it.
Andrew Innes <andrewi@gnu.org>
parents:
34643
diff
changeset
|
14126 error ("ShellExecute failed: %s", w32_strerror (0)); |
24670 | 14127 } |
14128 | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14129 /* Lookup virtual keycode from string representing the name of a |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14130 non-ascii keystroke into the corresponding virtual key, using |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14131 lispy_function_keys. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14132 static int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14133 lookup_vk_code (char *key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14134 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14135 int i; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14136 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14137 for (i = 0; i < 256; i++) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14138 if (lispy_function_keys[i] != 0 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14139 && strcmp (lispy_function_keys[i], key) == 0) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14140 return i; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14141 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14142 return -1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14143 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14144 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14145 /* Convert a one-element vector style key sequence to a hot key |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14146 definition. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14147 static int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14148 w32_parse_hot_key (key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14149 Lisp_Object key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14150 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14151 /* Copied from Fdefine_key and store_in_keymap. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14152 register Lisp_Object c; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14153 int vk_code; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14154 int lisp_modifiers; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14155 int w32_modifiers; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14156 struct gcpro gcpro1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14157 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
14158 CHECK_VECTOR (key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14159 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14160 if (XFASTINT (Flength (key)) != 1) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14161 return Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14162 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14163 GCPRO1 (key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14164 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14165 c = Faref (key, make_number (0)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14166 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14167 if (CONSP (c) && lucid_event_type_list_p (c)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14168 c = Fevent_convert_list (c); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14169 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14170 UNGCPRO; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14171 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14172 if (! INTEGERP (c) && ! SYMBOLP (c)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14173 error ("Key definition is invalid"); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14174 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14175 /* Work out the base key and the modifiers. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14176 if (SYMBOLP (c)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14177 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14178 c = parse_modifiers (c); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14179 lisp_modifiers = Fcar (Fcdr (c)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14180 c = Fcar (c); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14181 if (!SYMBOLP (c)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14182 abort (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14183 vk_code = lookup_vk_code (XSYMBOL (c)->name->data); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14184 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14185 else if (INTEGERP (c)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14186 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14187 lisp_modifiers = XINT (c) & ~CHARACTERBITS; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14188 /* Many ascii characters are their own virtual key code. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14189 vk_code = XINT (c) & CHARACTERBITS; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14190 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14191 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14192 if (vk_code < 0 || vk_code > 255) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14193 return Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14194 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14195 if ((lisp_modifiers & meta_modifier) != 0 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14196 && !NILP (Vw32_alt_is_meta)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14197 lisp_modifiers |= alt_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14198 |
31110 | 14199 /* Supply defs missing from mingw32. */ |
14200 #ifndef MOD_ALT | |
14201 #define MOD_ALT 0x0001 | |
14202 #define MOD_CONTROL 0x0002 | |
14203 #define MOD_SHIFT 0x0004 | |
14204 #define MOD_WIN 0x0008 | |
14205 #endif | |
14206 | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14207 /* Convert lisp modifiers to Windows hot-key form. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14208 w32_modifiers = (lisp_modifiers & hyper_modifier) ? MOD_WIN : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14209 w32_modifiers |= (lisp_modifiers & alt_modifier) ? MOD_ALT : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14210 w32_modifiers |= (lisp_modifiers & ctrl_modifier) ? MOD_CONTROL : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14211 w32_modifiers |= (lisp_modifiers & shift_modifier) ? MOD_SHIFT : 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14212 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14213 return HOTKEY (vk_code, w32_modifiers); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14214 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14215 |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14216 DEFUN ("w32-register-hot-key", Fw32_register_hot_key, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14217 Sw32_register_hot_key, 1, 1, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14218 doc: /* Register KEY as a hot-key combination. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14219 Certain key combinations like Alt-Tab are reserved for system use on |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14220 Windows, and therefore are normally intercepted by the system. However, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14221 most of these key combinations can be received by registering them as |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14222 hot-keys, overriding their special meaning. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14223 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14224 KEY must be a one element key definition in vector form that would be |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14225 acceptable to `define-key' (e.g. [A-tab] for Alt-Tab). The meta |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14226 modifier is interpreted as Alt if `w32-alt-is-meta' is t, and hyper |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14227 is always interpreted as the Windows modifier keys. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14228 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14229 The return value is the hotkey-id if registered, otherwise nil. */) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14230 (key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14231 Lisp_Object key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14232 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14233 key = w32_parse_hot_key (key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14234 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14235 if (NILP (Fmemq (key, w32_grabbed_keys))) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14236 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14237 /* Reuse an empty slot if possible. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14238 Lisp_Object item = Fmemq (Qnil, w32_grabbed_keys); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14239 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14240 /* Safe to add new key to list, even if we have focus. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14241 if (NILP (item)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14242 w32_grabbed_keys = Fcons (key, w32_grabbed_keys); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14243 else |
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
39812
diff
changeset
|
14244 XSETCAR (item, key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14245 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14246 /* Notify input thread about new hot-key definition, so that it |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14247 takes effect without needing to switch focus. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14248 PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14249 (WPARAM) key, 0); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14250 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14251 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14252 return key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14253 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14254 |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14255 DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14256 Sw32_unregister_hot_key, 1, 1, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14257 doc: /* Unregister HOTKEY as a hot-key combination. */) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14258 (key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14259 Lisp_Object key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14260 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14261 Lisp_Object item; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14262 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14263 if (!INTEGERP (key)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14264 key = w32_parse_hot_key (key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14265 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14266 item = Fmemq (key, w32_grabbed_keys); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14267 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14268 if (!NILP (item)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14269 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14270 /* Notify input thread about hot-key definition being removed, so |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14271 that it takes effect without needing focus switch. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14272 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14273 (WPARAM) XINT (XCAR (item)), (LPARAM) item)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14274 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14275 MSG msg; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14276 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14277 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14278 return Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14279 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14280 return Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14281 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14282 |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14283 DEFUN ("w32-registered-hot-keys", Fw32_registered_hot_keys, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14284 Sw32_registered_hot_keys, 0, 0, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14285 doc: /* Return list of registered hot-key IDs. */) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14286 () |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14287 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14288 return Fcopy_sequence (w32_grabbed_keys); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14289 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14290 |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14291 DEFUN ("w32-reconstruct-hot-key", Fw32_reconstruct_hot_key, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14292 Sw32_reconstruct_hot_key, 1, 1, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14293 doc: /* Convert hot-key ID to a lisp key combination. */) |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14294 (hotkeyid) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14295 Lisp_Object hotkeyid; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14296 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14297 int vk_code, w32_modifiers; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14298 Lisp_Object key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14299 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
14300 CHECK_NUMBER (hotkeyid); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14301 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14302 vk_code = HOTKEY_VK_CODE (hotkeyid); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14303 w32_modifiers = HOTKEY_MODIFIERS (hotkeyid); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14304 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14305 if (lispy_function_keys[vk_code]) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14306 key = intern (lispy_function_keys[vk_code]); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14307 else |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14308 key = make_number (vk_code); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14309 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14310 key = Fcons (key, Qnil); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14311 if (w32_modifiers & MOD_SHIFT) |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
14312 key = Fcons (Qshift, key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14313 if (w32_modifiers & MOD_CONTROL) |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
14314 key = Fcons (Qctrl, key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14315 if (w32_modifiers & MOD_ALT) |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
14316 key = Fcons (NILP (Vw32_alt_is_meta) ? Qalt : Qmeta, key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14317 if (w32_modifiers & MOD_WIN) |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
14318 key = Fcons (Qhyper, key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14319 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14320 return key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14321 } |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14322 |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14323 DEFUN ("w32-toggle-lock-key", Fw32_toggle_lock_key, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14324 Sw32_toggle_lock_key, 1, 2, 0, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14325 doc: /* Toggle the state of the lock key KEY. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14326 KEY can be `capslock', `kp-numlock', or `scroll'. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14327 If the optional parameter NEW-STATE is a number, then the state of KEY |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14328 is set to off if the low bit of NEW-STATE is zero, otherwise on. */) |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14329 (key, new_state) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14330 Lisp_Object key, new_state; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14331 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14332 int vk_code; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14333 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14334 if (EQ (key, intern ("capslock"))) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14335 vk_code = VK_CAPITAL; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14336 else if (EQ (key, intern ("kp-numlock"))) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14337 vk_code = VK_NUMLOCK; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14338 else if (EQ (key, intern ("scroll"))) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14339 vk_code = VK_SCROLL; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14340 else |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14341 return Qnil; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14342 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14343 if (!dwWindowsThreadId) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14344 return make_number (w32_console_toggle_lock_key (vk_code, new_state)); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14345 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14346 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14347 (WPARAM) vk_code, (LPARAM) new_state)) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14348 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14349 MSG msg; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14350 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14351 return make_number (msg.wParam); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14352 } |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14353 return Qnil; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14354 } |
13434 | 14355 |
34643
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14356 DEFUN ("file-system-info", Ffile_system_info, Sfile_system_info, 1, 1, 0, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14357 doc: /* Return storage information about the file system FILENAME is on. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14358 Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14359 storage of the file system, FREE is the free storage, and AVAIL is the |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14360 storage available to a non-superuser. All 3 numbers are in bytes. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14361 If the underlying system call fails, value is nil. */) |
34643
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14362 (filename) |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14363 Lisp_Object filename; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14364 { |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14365 Lisp_Object encoded, value; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14366 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
14367 CHECK_STRING (filename); |
34643
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14368 filename = Fexpand_file_name (filename, Qnil); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14369 encoded = ENCODE_FILE (filename); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14370 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14371 value = Qnil; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14372 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14373 /* Determining the required information on Windows turns out, sadly, |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14374 to be more involved than one would hope. The original Win32 api |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14375 call for this will return bogus information on some systems, but we |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14376 must dynamically probe for the replacement api, since that was |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14377 added rather late on. */ |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14378 { |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14379 HMODULE hKernel = GetModuleHandle ("kernel32"); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14380 BOOL (*pfn_GetDiskFreeSpaceEx) |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14381 (char *, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER) |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14382 = (void *) GetProcAddress (hKernel, "GetDiskFreeSpaceEx"); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14383 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14384 /* On Windows, we may need to specify the root directory of the |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14385 volume holding FILENAME. */ |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14386 char rootname[MAX_PATH]; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14387 char *name = XSTRING (encoded)->data; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14388 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14389 /* find the root name of the volume if given */ |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14390 if (isalpha (name[0]) && name[1] == ':') |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14391 { |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14392 rootname[0] = name[0]; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14393 rootname[1] = name[1]; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14394 rootname[2] = '\\'; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14395 rootname[3] = 0; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14396 } |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14397 else if (IS_DIRECTORY_SEP (name[0]) && IS_DIRECTORY_SEP (name[1])) |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14398 { |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14399 char *str = rootname; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14400 int slashes = 4; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14401 do |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14402 { |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14403 if (IS_DIRECTORY_SEP (*name) && --slashes == 0) |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14404 break; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14405 *str++ = *name++; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14406 } |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14407 while ( *name ); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14408 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14409 *str++ = '\\'; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14410 *str = 0; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14411 } |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14412 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14413 if (pfn_GetDiskFreeSpaceEx) |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14414 { |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14415 LARGE_INTEGER availbytes; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14416 LARGE_INTEGER freebytes; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14417 LARGE_INTEGER totalbytes; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14418 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14419 if (pfn_GetDiskFreeSpaceEx(rootname, |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14420 &availbytes, |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14421 &totalbytes, |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14422 &freebytes)) |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14423 value = list3 (make_float ((double) totalbytes.QuadPart), |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14424 make_float ((double) freebytes.QuadPart), |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14425 make_float ((double) availbytes.QuadPart)); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14426 } |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14427 else |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14428 { |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14429 DWORD sectors_per_cluster; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14430 DWORD bytes_per_sector; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14431 DWORD free_clusters; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14432 DWORD total_clusters; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14433 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14434 if (GetDiskFreeSpace(rootname, |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14435 §ors_per_cluster, |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14436 &bytes_per_sector, |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14437 &free_clusters, |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14438 &total_clusters)) |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14439 value = list3 (make_float ((double) total_clusters |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14440 * sectors_per_cluster * bytes_per_sector), |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14441 make_float ((double) free_clusters |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14442 * sectors_per_cluster * bytes_per_sector), |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14443 make_float ((double) free_clusters |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14444 * sectors_per_cluster * bytes_per_sector)); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14445 } |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14446 } |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14447 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14448 return value; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14449 } |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14450 |
41480
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
14451 /*********************************************************************** |
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
14452 Initialization |
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
14453 ***********************************************************************/ |
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
14454 |
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
14455 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14456 syms_of_w32fns () |
13434 | 14457 { |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
14458 HMODULE user32_lib = GetModuleHandle ("user32.dll"); |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
14459 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14460 /* This is zero if not using MS-Windows. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14461 w32_in_use = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14462 |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
14463 /* TrackMouseEvent not available in all versions of Windows, so must load |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
14464 it dynamically. Do it once, here, instead of every time it is used. */ |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
14465 track_mouse_event_fn = GetProcAddress (user32_lib, "TrackMouseEvent"); |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
14466 track_mouse_window = NULL; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
14467 |
42918
9b06036a8c5e
(syms_of_w32fns): Initialize w32_visible_system_caret_hwnd.
Jason Rumney <jasonr@gnu.org>
parents:
42865
diff
changeset
|
14468 w32_visible_system_caret_hwnd = NULL; |
9b06036a8c5e
(syms_of_w32fns): Initialize w32_visible_system_caret_hwnd.
Jason Rumney <jasonr@gnu.org>
parents:
42865
diff
changeset
|
14469 |
13434 | 14470 /* The section below is built by the lisp expression at the top of the file, |
14471 just above where these variables are declared. */ | |
14472 /*&&& init symbols here &&&*/ | |
14473 Qauto_raise = intern ("auto-raise"); | |
14474 staticpro (&Qauto_raise); | |
14475 Qauto_lower = intern ("auto-lower"); | |
14476 staticpro (&Qauto_lower); | |
14477 Qbar = intern ("bar"); | |
14478 staticpro (&Qbar); | |
14479 Qborder_color = intern ("border-color"); | |
14480 staticpro (&Qborder_color); | |
14481 Qborder_width = intern ("border-width"); | |
14482 staticpro (&Qborder_width); | |
14483 Qbox = intern ("box"); | |
14484 staticpro (&Qbox); | |
14485 Qcursor_color = intern ("cursor-color"); | |
14486 staticpro (&Qcursor_color); | |
14487 Qcursor_type = intern ("cursor-type"); | |
14488 staticpro (&Qcursor_type); | |
14489 Qgeometry = intern ("geometry"); | |
14490 staticpro (&Qgeometry); | |
14491 Qicon_left = intern ("icon-left"); | |
14492 staticpro (&Qicon_left); | |
14493 Qicon_top = intern ("icon-top"); | |
14494 staticpro (&Qicon_top); | |
14495 Qicon_type = intern ("icon-type"); | |
14496 staticpro (&Qicon_type); | |
14497 Qicon_name = intern ("icon-name"); | |
14498 staticpro (&Qicon_name); | |
14499 Qinternal_border_width = intern ("internal-border-width"); | |
14500 staticpro (&Qinternal_border_width); | |
14501 Qleft = intern ("left"); | |
14502 staticpro (&Qleft); | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
14503 Qright = intern ("right"); |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
14504 staticpro (&Qright); |
13434 | 14505 Qmouse_color = intern ("mouse-color"); |
14506 staticpro (&Qmouse_color); | |
14507 Qnone = intern ("none"); | |
14508 staticpro (&Qnone); | |
14509 Qparent_id = intern ("parent-id"); | |
14510 staticpro (&Qparent_id); | |
14511 Qscroll_bar_width = intern ("scroll-bar-width"); | |
14512 staticpro (&Qscroll_bar_width); | |
14513 Qsuppress_icon = intern ("suppress-icon"); | |
14514 staticpro (&Qsuppress_icon); | |
14515 Qundefined_color = intern ("undefined-color"); | |
14516 staticpro (&Qundefined_color); | |
14517 Qvertical_scroll_bars = intern ("vertical-scroll-bars"); | |
14518 staticpro (&Qvertical_scroll_bars); | |
14519 Qvisibility = intern ("visibility"); | |
14520 staticpro (&Qvisibility); | |
14521 Qwindow_id = intern ("window-id"); | |
14522 staticpro (&Qwindow_id); | |
14523 Qx_frame_parameter = intern ("x-frame-parameter"); | |
14524 staticpro (&Qx_frame_parameter); | |
14525 Qx_resource_name = intern ("x-resource-name"); | |
14526 staticpro (&Qx_resource_name); | |
14527 Quser_position = intern ("user-position"); | |
14528 staticpro (&Quser_position); | |
14529 Quser_size = intern ("user-size"); | |
14530 staticpro (&Quser_size); | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14531 Qscreen_gamma = intern ("screen-gamma"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14532 staticpro (&Qscreen_gamma); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14533 Qline_spacing = intern ("line-spacing"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14534 staticpro (&Qline_spacing); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14535 Qcenter = intern ("center"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14536 staticpro (&Qcenter); |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
14537 Qcancel_timer = intern ("cancel-timer"); |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
14538 staticpro (&Qcancel_timer); |
13434 | 14539 /* This is the end of symbol initialization. */ |
14540 | |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14541 Qhyper = intern ("hyper"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14542 staticpro (&Qhyper); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14543 Qsuper = intern ("super"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14544 staticpro (&Qsuper); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14545 Qmeta = intern ("meta"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14546 staticpro (&Qmeta); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14547 Qalt = intern ("alt"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14548 staticpro (&Qalt); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14549 Qctrl = intern ("ctrl"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14550 staticpro (&Qctrl); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14551 Qcontrol = intern ("control"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14552 staticpro (&Qcontrol); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14553 Qshift = intern ("shift"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14554 staticpro (&Qshift); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14555 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14556 /* Text property `display' should be nonsticky by default. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14557 Vtext_property_default_nonsticky |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14558 = Fcons (Fcons (Qdisplay, Qt), Vtext_property_default_nonsticky); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14559 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14560 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14561 Qlaplace = intern ("laplace"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14562 staticpro (&Qlaplace); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14563 Qemboss = intern ("emboss"); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14564 staticpro (&Qemboss); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14565 Qedge_detection = intern ("edge-detection"); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14566 staticpro (&Qedge_detection); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14567 Qheuristic = intern ("heuristic"); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14568 staticpro (&Qheuristic); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14569 QCmatrix = intern (":matrix"); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14570 staticpro (&QCmatrix); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14571 QCcolor_adjustment = intern (":color-adjustment"); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14572 staticpro (&QCcolor_adjustment); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14573 QCmask = intern (":mask"); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14574 staticpro (&QCmask); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14575 |
22625
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
14576 Qface_set_after_frame_default = intern ("face-set-after-frame-default"); |
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
14577 staticpro (&Qface_set_after_frame_default); |
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
14578 |
13434 | 14579 Fput (Qundefined_color, Qerror_conditions, |
14580 Fcons (Qundefined_color, Fcons (Qerror, Qnil))); | |
14581 Fput (Qundefined_color, Qerror_message, | |
14582 build_string ("Undefined color")); | |
14583 | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14584 staticpro (&w32_grabbed_keys); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14585 w32_grabbed_keys = Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14586 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14587 DEFVAR_LISP ("w32-color-map", &Vw32_color_map, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14588 doc: /* An array of color name mappings for windows. */); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14589 Vw32_color_map = Qnil; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14590 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14591 DEFVAR_LISP ("w32-pass-alt-to-system", &Vw32_pass_alt_to_system, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14592 doc: /* Non-nil if alt key presses are passed on to Windows. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14593 When non-nil, for example, alt pressed and released and then space will |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14594 open the System menu. When nil, Emacs silently swallows alt key events. */); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14595 Vw32_pass_alt_to_system = Qnil; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14596 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14597 DEFVAR_LISP ("w32-alt-is-meta", &Vw32_alt_is_meta, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14598 doc: /* Non-nil if the alt key is to be considered the same as the meta key. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14599 When nil, Emacs will translate the alt key to the Alt modifier, and not Meta. */); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14600 Vw32_alt_is_meta = Qt; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14601 |
24339
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
14602 DEFVAR_INT ("w32-quit-key", &Vw32_quit_key, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14603 doc: /* If non-zero, the virtual key code for an alternative quit key. */); |
24339
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
14604 XSETINT (Vw32_quit_key, 0); |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
14605 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14606 DEFVAR_LISP ("w32-pass-lwindow-to-system", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14607 &Vw32_pass_lwindow_to_system, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14608 doc: /* Non-nil if the left \"Windows\" key is passed on to Windows. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14609 When non-nil, the Start menu is opened by tapping the key. */); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14610 Vw32_pass_lwindow_to_system = Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14611 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14612 DEFVAR_LISP ("w32-pass-rwindow-to-system", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14613 &Vw32_pass_rwindow_to_system, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14614 doc: /* Non-nil if the right \"Windows\" key is passed on to Windows. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14615 When non-nil, the Start menu is opened by tapping the key. */); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14616 Vw32_pass_rwindow_to_system = Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14617 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14618 DEFVAR_INT ("w32-phantom-key-code", |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14619 &Vw32_phantom_key_code, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14620 doc: /* Virtual key code used to generate \"phantom\" key presses. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14621 Value is a number between 0 and 255. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14622 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14623 Phantom key presses are generated in order to stop the system from |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14624 acting on \"Windows\" key events when `w32-pass-lwindow-to-system' or |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14625 `w32-pass-rwindow-to-system' is nil. */); |
24718
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
14626 /* Although 255 is technically not a valid key code, it works and |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
14627 means that this hack won't interfere with any real key code. */ |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
14628 Vw32_phantom_key_code = 255; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14629 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14630 DEFVAR_LISP ("w32-enable-num-lock", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14631 &Vw32_enable_num_lock, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14632 doc: /* Non-nil if Num Lock should act normally. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14633 Set to nil to see Num Lock as the key `kp-numlock'. */); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14634 Vw32_enable_num_lock = Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14635 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14636 DEFVAR_LISP ("w32-enable-caps-lock", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14637 &Vw32_enable_caps_lock, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14638 doc: /* Non-nil if Caps Lock should act normally. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14639 Set to nil to see Caps Lock as the key `capslock'. */); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14640 Vw32_enable_caps_lock = Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14641 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14642 DEFVAR_LISP ("w32-scroll-lock-modifier", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14643 &Vw32_scroll_lock_modifier, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14644 doc: /* Modifier to use for the Scroll Lock on state. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14645 The value can be hyper, super, meta, alt, control or shift for the |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14646 respective modifier, or nil to see Scroll Lock as the key `scroll'. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14647 Any other value will cause the key to be ignored. */); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14648 Vw32_scroll_lock_modifier = Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14649 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14650 DEFVAR_LISP ("w32-lwindow-modifier", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14651 &Vw32_lwindow_modifier, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14652 doc: /* Modifier to use for the left \"Windows\" key. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14653 The value can be hyper, super, meta, alt, control or shift for the |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14654 respective modifier, or nil to appear as the key `lwindow'. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14655 Any other value will cause the key to be ignored. */); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14656 Vw32_lwindow_modifier = Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14657 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14658 DEFVAR_LISP ("w32-rwindow-modifier", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14659 &Vw32_rwindow_modifier, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14660 doc: /* Modifier to use for the right \"Windows\" key. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14661 The value can be hyper, super, meta, alt, control or shift for the |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14662 respective modifier, or nil to appear as the key `rwindow'. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14663 Any other value will cause the key to be ignored. */); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14664 Vw32_rwindow_modifier = Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14665 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14666 DEFVAR_LISP ("w32-apps-modifier", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14667 &Vw32_apps_modifier, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14668 doc: /* Modifier to use for the \"Apps\" key. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14669 The value can be hyper, super, meta, alt, control or shift for the |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14670 respective modifier, or nil to appear as the key `apps'. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14671 Any other value will cause the key to be ignored. */); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14672 Vw32_apps_modifier = Qnil; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14673 |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14674 DEFVAR_BOOL ("w32-enable-synthesized-fonts", &w32_enable_synthesized_fonts, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14675 doc: /* Non-nil enables selection of artificially italicized and bold fonts. */); |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14676 w32_enable_synthesized_fonts = 0; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14677 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14678 DEFVAR_LISP ("w32-enable-palette", &Vw32_enable_palette, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14679 doc: /* Non-nil enables Windows palette management to map colors exactly. */); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14680 Vw32_enable_palette = Qt; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14681 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14682 DEFVAR_INT ("w32-mouse-button-tolerance", |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14683 &Vw32_mouse_button_tolerance, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14684 doc: /* Analogue of double click interval for faking middle mouse events. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14685 The value is the minimum time in milliseconds that must elapse between |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14686 left/right button down events before they are considered distinct events. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14687 If both mouse buttons are depressed within this interval, a middle mouse |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14688 button down event is generated instead. */); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14689 XSETINT (Vw32_mouse_button_tolerance, GetDoubleClickTime () / 2); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14690 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14691 DEFVAR_INT ("w32-mouse-move-interval", |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14692 &Vw32_mouse_move_interval, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14693 doc: /* Minimum interval between mouse move events. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14694 The value is the minimum time in milliseconds that must elapse between |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14695 successive mouse move (or scroll bar drag) events before they are |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14696 reported as lisp events. */); |
24252
e0ae6525db58
(syms_of_w32fns): Change default value of w32-mouse-move-interval to
Andrew Innes <andrewi@gnu.org>
parents:
24214
diff
changeset
|
14697 XSETINT (Vw32_mouse_move_interval, 0); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
14698 |
42719
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
14699 DEFVAR_BOOL ("w32-pass-extra-mouse-buttons-to-system", |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
14700 &w32_pass_extra_mouse_buttons_to_system, |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
14701 doc: /* Non-nil if the fourth and fifth mouse buttons are passed to Windows. |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
14702 Recent versions of Windows support mice with up to five buttons. |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
14703 Since most applications don't support these extra buttons, most mouse |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
14704 drivers will allow you to map them to functions at the system level. |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
14705 If this variable is non-nil, Emacs will pass them on, allowing the |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
14706 system to handle them. */); |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
14707 w32_pass_extra_mouse_buttons_to_system = 0; |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
14708 |
13434 | 14709 init_x_parm_symbols (); |
14710 | |
14711 DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14712 doc: /* List of directories to search for bitmap files for w32. */); |
13434 | 14713 Vx_bitmap_file_path = decode_env_path ((char *) 0, "PATH"); |
14714 | |
14715 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14716 doc: /* The shape of the pointer when over text. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14717 Changing the value does not affect existing frames |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14718 unless you set the mouse color. */); |
13434 | 14719 Vx_pointer_shape = Qnil; |
14720 | |
14721 DEFVAR_LISP ("x-resource-name", &Vx_resource_name, | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14722 doc: /* The name Emacs uses to look up resources; for internal use only. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14723 `x-get-resource' uses this as the first component of the instance name |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14724 when requesting resource values. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14725 Emacs initially sets `x-resource-name' to the name under which Emacs |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14726 was invoked, or to the value specified with the `-name' or `-rn' |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14727 switches, if present. */); |
13434 | 14728 Vx_resource_name = Qnil; |
14729 | |
14730 Vx_nontext_pointer_shape = Qnil; | |
14731 | |
14732 Vx_mode_pointer_shape = Qnil; | |
14733 | |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
14734 DEFVAR_LISP ("x-hourglass-pointer-shape", &Vx_hourglass_pointer_shape, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14735 doc: /* The shape of the pointer when Emacs is busy. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14736 This variable takes effect when you create a new frame |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14737 or when you set the mouse color. */); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
14738 Vx_hourglass_pointer_shape = Qnil; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
14739 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
14740 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14741 doc: /* Non-zero means Emacs displays an hourglass pointer on window systems. */); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
14742 display_hourglass_p = 1; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
14743 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
14744 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14745 doc: /* *Seconds to wait before displaying an hourglass pointer. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14746 Value must be an integer or float. */); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
14747 Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY); |
27936
4c1ad68f8688
Bring up to date with xfns.c changes from 2000-02-25 and 2000-02-21.
Jason Rumney <jasonr@gnu.org>
parents:
27894
diff
changeset
|
14748 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14749 DEFVAR_LISP ("x-sensitive-text-pointer-shape", |
13434 | 14750 &Vx_sensitive_text_pointer_shape, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14751 doc: /* The shape of the pointer when over mouse-sensitive text. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14752 This variable takes effect when you create a new frame |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14753 or when you set the mouse color. */); |
13434 | 14754 Vx_sensitive_text_pointer_shape = Qnil; |
14755 | |
34133
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
14756 DEFVAR_LISP ("x-window-horizontal-drag-cursor", |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
14757 &Vx_window_horizontal_drag_shape, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14758 doc: /* Pointer shape to use for indicating a window can be dragged horizontally. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14759 This variable takes effect when you create a new frame |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14760 or when you set the mouse color. */); |
34133
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
14761 Vx_window_horizontal_drag_shape = Qnil; |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
14762 |
13434 | 14763 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14764 doc: /* A string indicating the foreground color of the cursor box. */); |
13434 | 14765 Vx_cursor_fore_pixel = Qnil; |
14766 | |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14767 DEFVAR_LISP ("x-max-tooltip-size", &Vx_max_tooltip_size, |
41019 | 14768 doc: /* Maximum size for tooltips. |
14769 Value is a pair (COLUMNS . ROWS). Text larger than this is clipped. */); | |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14770 Vx_max_tooltip_size = Fcons (make_number (80), make_number (40)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14771 |
13434 | 14772 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14773 doc: /* Non-nil if no window manager is in use. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14774 Emacs doesn't try to figure this out; this is always nil |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14775 unless you set it to something else. */); |
13434 | 14776 /* We don't have any way to find this out, so set it to nil |
14777 and maybe the user would like to set it to t. */ | |
14778 Vx_no_window_manager = Qnil; | |
14779 | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
14780 DEFVAR_LISP ("x-pixel-size-width-font-regexp", |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
14781 &Vx_pixel_size_width_font_regexp, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14782 doc: /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14783 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14784 Since Emacs gets width of a font matching with this regexp from |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14785 PIXEL_SIZE field of the name, font finding mechanism gets faster for |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14786 such a font. This is especially effective for such large fonts as |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14787 Chinese, Japanese, and Korean. */); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
14788 Vx_pixel_size_width_font_regexp = Qnil; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
14789 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14790 DEFVAR_LISP ("image-cache-eviction-delay", &Vimage_cache_eviction_delay, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14791 doc: /* Time after which cached images are removed from the cache. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14792 When an image has not been displayed this many seconds, remove it |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14793 from the image cache. Value must be an integer or nil with nil |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14794 meaning don't clear the cache. */); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14795 Vimage_cache_eviction_delay = make_number (30 * 60); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14796 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
14797 DEFVAR_LISP ("w32-bdf-filename-alist", |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
14798 &Vw32_bdf_filename_alist, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14799 doc: /* List of bdf fonts and their corresponding filenames. */); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
14800 Vw32_bdf_filename_alist = Qnil; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
14801 |
24481
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
14802 DEFVAR_BOOL ("w32-strict-fontnames", |
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
14803 &w32_strict_fontnames, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14804 doc: /* Non-nil means only use fonts that are exact matches for those requested. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14805 Default is nil, which allows old fontnames that are not XLFD compliant, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14806 and allows third-party CJK display to work by specifying false charset |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14807 fields to trick Emacs into translating to Big5, SJIS etc. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14808 Setting this to t will prevent wrong fonts being selected when |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14809 fontsets are automatically created. */); |
24481
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
14810 w32_strict_fontnames = 0; |
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
14811 |
24695
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
14812 DEFVAR_BOOL ("w32-strict-painting", |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
14813 &w32_strict_painting, |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14814 doc: /* Non-nil means use strict rules for repainting frames. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14815 Set this to nil to get the old behaviour for repainting; this should |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14816 only be necessary if the default setting causes problems. */); |
24695
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
14817 w32_strict_painting = 1; |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
14818 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14819 DEFVAR_LISP ("w32-charset-info-alist", |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14820 &Vw32_charset_info_alist, |
41019 | 14821 doc: /* Alist linking Emacs character sets to Windows fonts and codepages. |
14822 Each entry should be of the form: | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14823 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14824 (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)) |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14825 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14826 where CHARSET_NAME is a string used in font names to identify the charset, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14827 WINDOWS_CHARSET is a symbol that can be one of: |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14828 w32-charset-ansi, w32-charset-default, w32-charset-symbol, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14829 w32-charset-shiftjis, w32-charset-hangeul, w32-charset-gb2312, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14830 w32-charset-chinesebig5, |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14831 #ifdef JOHAB_CHARSET |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14832 w32-charset-johab, w32-charset-hebrew, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14833 w32-charset-arabic, w32-charset-greek, w32-charset-turkish, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14834 w32-charset-vietnamese, w32-charset-thai, w32-charset-easteurope, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14835 w32-charset-russian, w32-charset-mac, w32-charset-baltic, |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14836 #endif |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14837 #ifdef UNICODE_CHARSET |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14838 w32-charset-unicode, |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14839 #endif |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14840 or w32-charset-oem. |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14841 CODEPAGE should be an integer specifying the codepage that should be used |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14842 to display the character set, t to do no translation and output as Unicode, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14843 or nil to do no translation and output as 8 bit (or multibyte on far-east |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14844 versions of Windows) characters. */); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14845 Vw32_charset_info_alist = Qnil; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14846 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14847 staticpro (&Qw32_charset_ansi); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14848 Qw32_charset_ansi = intern ("w32-charset-ansi"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14849 staticpro (&Qw32_charset_symbol); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14850 Qw32_charset_symbol = intern ("w32-charset-symbol"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14851 staticpro (&Qw32_charset_shiftjis); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14852 Qw32_charset_shiftjis = intern ("w32-charset-shiftjis"); |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
14853 staticpro (&Qw32_charset_hangeul); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
14854 Qw32_charset_hangeul = intern ("w32-charset-hangeul"); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14855 staticpro (&Qw32_charset_chinesebig5); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14856 Qw32_charset_chinesebig5 = intern ("w32-charset-chinesebig5"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14857 staticpro (&Qw32_charset_gb2312); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14858 Qw32_charset_gb2312 = intern ("w32-charset-gb2312"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14859 staticpro (&Qw32_charset_oem); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14860 Qw32_charset_oem = intern ("w32-charset-oem"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14861 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14862 #ifdef JOHAB_CHARSET |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14863 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14864 static int w32_extra_charsets_defined = 1; |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14865 DEFVAR_BOOL ("w32-extra-charsets-defined", &w32_extra_charsets_defined, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14866 doc: /* Internal variable. */); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14867 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14868 staticpro (&Qw32_charset_johab); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14869 Qw32_charset_johab = intern ("w32-charset-johab"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14870 staticpro (&Qw32_charset_easteurope); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14871 Qw32_charset_easteurope = intern ("w32-charset-easteurope"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14872 staticpro (&Qw32_charset_turkish); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14873 Qw32_charset_turkish = intern ("w32-charset-turkish"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14874 staticpro (&Qw32_charset_baltic); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14875 Qw32_charset_baltic = intern ("w32-charset-baltic"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14876 staticpro (&Qw32_charset_russian); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14877 Qw32_charset_russian = intern ("w32-charset-russian"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14878 staticpro (&Qw32_charset_arabic); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14879 Qw32_charset_arabic = intern ("w32-charset-arabic"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14880 staticpro (&Qw32_charset_greek); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14881 Qw32_charset_greek = intern ("w32-charset-greek"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14882 staticpro (&Qw32_charset_hebrew); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14883 Qw32_charset_hebrew = intern ("w32-charset-hebrew"); |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
14884 staticpro (&Qw32_charset_vietnamese); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
14885 Qw32_charset_vietnamese = intern ("w32-charset-vietnamese"); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14886 staticpro (&Qw32_charset_thai); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14887 Qw32_charset_thai = intern ("w32-charset-thai"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14888 staticpro (&Qw32_charset_mac); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14889 Qw32_charset_mac = intern ("w32-charset-mac"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14890 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14891 #endif |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14892 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14893 #ifdef UNICODE_CHARSET |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14894 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14895 static int w32_unicode_charset_defined = 1; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14896 DEFVAR_BOOL ("w32-unicode-charset-defined", |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14897 &w32_unicode_charset_defined, |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14898 doc: /* Internal variable. */); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14899 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14900 staticpro (&Qw32_charset_unicode); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14901 Qw32_charset_unicode = intern ("w32-charset-unicode"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14902 #endif |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14903 |
13434 | 14904 defsubr (&Sx_get_resource); |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
14905 #if 0 /* TODO: Port to W32 */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14906 defsubr (&Sx_change_window_property); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14907 defsubr (&Sx_delete_window_property); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14908 defsubr (&Sx_window_property); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14909 #endif |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
25646
diff
changeset
|
14910 defsubr (&Sxw_display_color_p); |
13434 | 14911 defsubr (&Sx_display_grayscale_p); |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
25646
diff
changeset
|
14912 defsubr (&Sxw_color_defined_p); |
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
25646
diff
changeset
|
14913 defsubr (&Sxw_color_values); |
13434 | 14914 defsubr (&Sx_server_max_request_size); |
14915 defsubr (&Sx_server_vendor); | |
14916 defsubr (&Sx_server_version); | |
14917 defsubr (&Sx_display_pixel_width); | |
14918 defsubr (&Sx_display_pixel_height); | |
14919 defsubr (&Sx_display_mm_width); | |
14920 defsubr (&Sx_display_mm_height); | |
14921 defsubr (&Sx_display_screens); | |
14922 defsubr (&Sx_display_planes); | |
14923 defsubr (&Sx_display_color_cells); | |
14924 defsubr (&Sx_display_visual_class); | |
14925 defsubr (&Sx_display_backing_store); | |
14926 defsubr (&Sx_display_save_under); | |
14927 defsubr (&Sx_parse_geometry); | |
14928 defsubr (&Sx_create_frame); | |
14929 defsubr (&Sx_open_connection); | |
14930 defsubr (&Sx_close_connection); | |
14931 defsubr (&Sx_display_list); | |
14932 defsubr (&Sx_synchronize); | |
14933 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14934 /* W32 specific functions */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14935 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14936 defsubr (&Sw32_focus_frame); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14937 defsubr (&Sw32_select_font); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14938 defsubr (&Sw32_define_rgb_color); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14939 defsubr (&Sw32_default_color_map); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14940 defsubr (&Sw32_load_color_file); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14941 defsubr (&Sw32_send_sys_command); |
24670 | 14942 defsubr (&Sw32_shell_execute); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14943 defsubr (&Sw32_register_hot_key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14944 defsubr (&Sw32_unregister_hot_key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14945 defsubr (&Sw32_registered_hot_keys); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14946 defsubr (&Sw32_reconstruct_hot_key); |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14947 defsubr (&Sw32_toggle_lock_key); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
14948 defsubr (&Sw32_find_bdf_fonts); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
14949 |
34643
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14950 defsubr (&Sfile_system_info); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14951 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
14952 /* Setting callback functions for fontset handler. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
14953 get_font_info_func = w32_get_font_info; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14954 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14955 #if 0 /* This function pointer doesn't seem to be used anywhere. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14956 And the pointer assigned has the wrong type, anyway. */ |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
14957 list_fonts_func = w32_list_fonts; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14958 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14959 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
14960 load_font_func = w32_load_font; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
14961 find_ccl_program_func = w32_find_ccl_program; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
14962 query_font_func = w32_query_font; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
14963 set_frame_fontset_func = x_set_font; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
14964 check_window_system_func = check_w32; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14965 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
14966 #if 0 /* TODO Image support for W32 */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14967 /* Images. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14968 Qxbm = intern ("xbm"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14969 staticpro (&Qxbm); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14970 QCtype = intern (":type"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14971 staticpro (&QCtype); |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
14972 QCconversion = intern (":conversion"); |
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
14973 staticpro (&QCconversion); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14974 QCheuristic_mask = intern (":heuristic-mask"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14975 staticpro (&QCheuristic_mask); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14976 QCcolor_symbols = intern (":color-symbols"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14977 staticpro (&QCcolor_symbols); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14978 QCascent = intern (":ascent"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14979 staticpro (&QCascent); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14980 QCmargin = intern (":margin"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14981 staticpro (&QCmargin); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14982 QCrelief = intern (":relief"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14983 staticpro (&QCrelief); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14984 Qpostscript = intern ("postscript"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14985 staticpro (&Qpostscript); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14986 QCloader = intern (":loader"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14987 staticpro (&QCloader); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14988 QCbounding_box = intern (":bounding-box"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14989 staticpro (&QCbounding_box); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14990 QCpt_width = intern (":pt-width"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14991 staticpro (&QCpt_width); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14992 QCpt_height = intern (":pt-height"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14993 staticpro (&QCpt_height); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14994 QCindex = intern (":index"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14995 staticpro (&QCindex); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14996 Qpbm = intern ("pbm"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14997 staticpro (&Qpbm); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14998 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14999 #if HAVE_XPM |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15000 Qxpm = intern ("xpm"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15001 staticpro (&Qxpm); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15002 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15003 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15004 #if HAVE_JPEG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15005 Qjpeg = intern ("jpeg"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15006 staticpro (&Qjpeg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15007 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15008 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15009 #if HAVE_TIFF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15010 Qtiff = intern ("tiff"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15011 staticpro (&Qtiff); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15012 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15013 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15014 #if HAVE_GIF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15015 Qgif = intern ("gif"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15016 staticpro (&Qgif); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15017 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15018 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15019 #if HAVE_PNG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15020 Qpng = intern ("png"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15021 staticpro (&Qpng); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15022 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15023 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15024 defsubr (&Sclear_image_cache); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15025 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15026 #if GLYPH_DEBUG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15027 defsubr (&Simagep); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15028 defsubr (&Slookup_image); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15029 #endif |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
15030 #endif /* TODO */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15031 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
15032 hourglass_atimer = NULL; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
15033 hourglass_shown_p = 0; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15034 defsubr (&Sx_show_tip); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15035 defsubr (&Sx_hide_tip); |
34729
3dc60d80125f
(syms_of_w32fns): Initialize and staticpro tip_frame.
Jason Rumney <jasonr@gnu.org>
parents:
34698
diff
changeset
|
15036 tip_timer = Qnil; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15037 staticpro (&tip_timer); |
34729
3dc60d80125f
(syms_of_w32fns): Initialize and staticpro tip_frame.
Jason Rumney <jasonr@gnu.org>
parents:
34698
diff
changeset
|
15038 tip_frame = Qnil; |
3dc60d80125f
(syms_of_w32fns): Initialize and staticpro tip_frame.
Jason Rumney <jasonr@gnu.org>
parents:
34698
diff
changeset
|
15039 staticpro (&tip_frame); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15040 |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
15041 last_show_tip_args = Qnil; |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
15042 staticpro (&last_show_tip_args); |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
15043 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15044 defsubr (&Sx_file_dialog); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15045 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15046 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15047 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15048 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15049 init_xfns () |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15050 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15051 image_types = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15052 Vimage_types = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15053 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
15054 #if 0 /* TODO : Image support for W32 */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15055 define_image_type (&xbm_type); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15056 define_image_type (&gs_type); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15057 define_image_type (&pbm_type); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15058 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15059 #if HAVE_XPM |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15060 define_image_type (&xpm_type); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15061 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15062 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15063 #if HAVE_JPEG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15064 define_image_type (&jpeg_type); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15065 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15066 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15067 #if HAVE_TIFF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15068 define_image_type (&tiff_type); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15069 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15070 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15071 #if HAVE_GIF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15072 define_image_type (&gif_type); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15073 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15074 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15075 #if HAVE_PNG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15076 define_image_type (&png_type); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15077 #endif |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
15078 #endif /* TODO */ |
13434 | 15079 } |
15080 | |
15081 #undef abort | |
15082 | |
15083 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
15084 w32_abort() |
13434 | 15085 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15086 int button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15087 button = MessageBox (NULL, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15088 "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
|
15089 "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
|
15090 "Emacs Abort Dialog", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15091 MB_ICONEXCLAMATION | MB_TASKMODAL |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15092 | MB_SETFOREGROUND | MB_ABORTRETRYIGNORE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15093 switch (button) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15094 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15095 case IDRETRY: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15096 DebugBreak (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15097 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15098 case IDIGNORE: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15099 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15100 case IDABORT: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15101 default: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15102 abort (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15103 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15104 } |
13434 | 15105 } |
15148
220145cf7546
(continuation of previous checkin)
Geoff Voelker <voelker@cs.washington.edu>
parents:
15147
diff
changeset
|
15106 |
23801
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
15107 /* For convenience when debugging. */ |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
15108 int |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
15109 w32_last_error() |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
15110 { |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
15111 return GetLastError (); |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
15112 } |